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 2008/03/20 11:23:24 UTC

[jira] Created: (HARMONY-5622) [drlvm][kernel][geronimo] Method.getGeneric*() methods throw NPE

[drlvm][kernel][geronimo] Method.getGeneric*() methods throw NPE
----------------------------------------------------------------

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


Class Method methods getGenericParameterTypes(), getGenericReturnType() and toGenericString() throw NPE if called for a parametrized method.

Here's the test demonstrating the problem:

import java.lang.reflect.Method;
public class Test {
    public static void main(String[] args) {
        boolean success = true;
        try {
            Method method = Sample.class.getMethods()[0];
            for (int i = 0; i < 5; i++) {
                try {
                    switch (i) {
                    case 0: method.getGenericParameterTypes();
                            break;
                    case 1: method.getGenericReturnType();
                            break;
                    case 2: method.getGenericExceptionTypes();
                            break;
                    case 3: method.getTypeParameters();
                            break;
                    case 4: method.toGenericString();
                            break;
                    }
                } catch (Exception e) {
                    success = false;
                    System.out.print("FAIL: ");
                    e.printStackTrace(System.out);
                }
            }
            System.out.println(success ? "SUCCESS" : "FAILURE");
        } catch (Exception e) {
            System.out.print("ERROR: ");
            e.printStackTrace(System.out);
        }
    }
}
interface Sample {
    public <T extends Sample, E extends Throwable> T test(T param) throws E;
}

Output on RI:

SUCCESS

Output on Harmony:

FAIL: java.lang.NullPointerException
        at org.apache.harmony.lang.reflect.support.AuxiliaryFinder.findTypeVariable(AuxiliaryFinder.java:293)
        at org.apache.harmony.lang.reflect.parser.Parser.getGenericParameterTypes(Parser.java:742)
        at java.lang.reflect.Method.getGenericParameterTypes(Method.java:110)
        at Test.main(Test.java:10)
FAIL: java.lang.NullPointerException
        at org.apache.harmony.lang.reflect.support.AuxiliaryFinder.findTypeVariable(AuxiliaryFinder.java:293)
        at org.apache.harmony.lang.reflect.parser.Parser.getGenericReturnTypeImpl(Parser.java:447)
        at java.lang.reflect.Method.getGenericReturnType(Method.java:126)
        at Test.main(Test.java:12)
FAIL: java.lang.NullPointerException
        at org.apache.harmony.lang.reflect.support.AuxiliaryFinder.findTypeVariable(AuxiliaryFinder.java:293)
        at org.apache.harmony.lang.reflect.parser.Parser.getGenericParameterTypes(Parser.java:742)
        at java.lang.reflect.Method.toGenericString(Method.java:150)
        at Test.main(Test.java:18)
FAILURE

This issue is critical as it prevents Geronimo Deployer from working 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-5622) [drlvm][kernel][geronimo] Method.getGeneric*() methods throw NPE for parametrized interface methods

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

Vasily Zakharov updated HARMONY-5622:
-------------------------------------

    Attachment: Harmony-5622.patch

Attached the updated patch taking care of Alexey's notes.


> [drlvm][kernel][geronimo] Method.getGeneric*() methods throw NPE for parametrized interface methods
> ---------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5622
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5622
>             Project: Harmony
>          Issue Type: Bug
>          Components: App-Oriented Bug Reports, DRLVM
>    Affects Versions: 5.0M5
>            Reporter: Vasily Zakharov
>            Assignee: Vasily Zakharov
>            Priority: Critical
>         Attachments: Harmony-5622.patch, Harmony-5622.patch
>
>
> Class Method methods getGenericParameterTypes(), getGenericReturnType() and toGenericString() throw NPE if called for a parametrized method in an interface.
> Here's the test demonstrating the problem:
> import java.lang.reflect.Method;
> public class Test {
>     public static void main(String[] args) {
>         boolean success = true;
>         try {
>             Method method = Sample.class.getMethods()[0];
>             for (int i = 0; i < 5; i++) {
>                 try {
>                     switch (i) {
>                     case 0: method.getGenericParameterTypes();
>                             break;
>                     case 1: method.getGenericReturnType();
>                             break;
>                     case 2: method.getGenericExceptionTypes();
>                             break;
>                     case 3: method.getTypeParameters();
>                             break;
>                     case 4: method.toGenericString();
>                             break;
>                     }
>                 } catch (Exception e) {
>                     success = false;
>                     System.out.print("FAIL: ");
>                     e.printStackTrace(System.out);
>                 }
>             }
>             System.out.println(success ? "SUCCESS" : "FAILURE");
>         } catch (Exception e) {
>             System.out.print("ERROR: ");
>             e.printStackTrace(System.out);
>         }
>     }
> }
> interface Sample {
>     public <T extends Sample, E extends Throwable> T test(T param) throws E;
> }
> Output on RI:
> SUCCESS
> Output on Harmony:
> FAIL: java.lang.NullPointerException
>         at org.apache.harmony.lang.reflect.support.AuxiliaryFinder.findTypeVariable(AuxiliaryFinder.java:293)
>         at org.apache.harmony.lang.reflect.parser.Parser.getGenericParameterTypes(Parser.java:742)
>         at java.lang.reflect.Method.getGenericParameterTypes(Method.java:110)
>         at Test.main(Test.java:10)
> FAIL: java.lang.NullPointerException
>         at org.apache.harmony.lang.reflect.support.AuxiliaryFinder.findTypeVariable(AuxiliaryFinder.java:293)
>         at org.apache.harmony.lang.reflect.parser.Parser.getGenericReturnTypeImpl(Parser.java:447)
>         at java.lang.reflect.Method.getGenericReturnType(Method.java:126)
>         at Test.main(Test.java:12)
> FAIL: java.lang.NullPointerException
>         at org.apache.harmony.lang.reflect.support.AuxiliaryFinder.findTypeVariable(AuxiliaryFinder.java:293)
>         at org.apache.harmony.lang.reflect.parser.Parser.getGenericParameterTypes(Parser.java:742)
>         at java.lang.reflect.Method.toGenericString(Method.java:150)
>         at Test.main(Test.java:18)
> FAILURE
> This issue is critical as it prevents Geronimo Deployer from working 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-5622) [drlvm][kernel][geronimo] Method.getGeneric*() methods throw NPE for parametrized interface methods

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

Vasily Zakharov commented on HARMONY-5622:
------------------------------------------

Committed regression test back to kernel test suite - the test was redesigned to use a separate thread to avoid stack overflow.


> [drlvm][kernel][geronimo] Method.getGeneric*() methods throw NPE for parametrized interface methods
> ---------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5622
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5622
>             Project: Harmony
>          Issue Type: Bug
>          Components: App-Oriented Bug Reports, DRLVM
>    Affects Versions: 5.0M5
>            Reporter: Vasily Zakharov
>            Assignee: Vasily Zakharov
>            Priority: Critical
>             Fix For: 5.0M6
>
>         Attachments: Harmony-5622.patch, Harmony-5622.patch
>
>
> Class Method methods getGenericParameterTypes(), getGenericReturnType() and toGenericString() throw NPE if called for a parametrized method in an interface.
> Here's the test demonstrating the problem:
> import java.lang.reflect.Method;
> public class Test {
>     public static void main(String[] args) {
>         boolean success = true;
>         try {
>             Method method = Sample.class.getMethods()[0];
>             for (int i = 0; i < 5; i++) {
>                 try {
>                     switch (i) {
>                     case 0: method.getGenericParameterTypes();
>                             break;
>                     case 1: method.getGenericReturnType();
>                             break;
>                     case 2: method.getGenericExceptionTypes();
>                             break;
>                     case 3: method.getTypeParameters();
>                             break;
>                     case 4: method.toGenericString();
>                             break;
>                     }
>                 } catch (Exception e) {
>                     success = false;
>                     System.out.print("FAIL: ");
>                     e.printStackTrace(System.out);
>                 }
>             }
>             System.out.println(success ? "SUCCESS" : "FAILURE");
>         } catch (Exception e) {
>             System.out.print("ERROR: ");
>             e.printStackTrace(System.out);
>         }
>     }
> }
> interface Sample {
>     public <T extends Sample, E extends Throwable> T test(T param) throws E;
> }
> Output on RI:
> SUCCESS
> Output on Harmony:
> FAIL: java.lang.NullPointerException
>         at org.apache.harmony.lang.reflect.support.AuxiliaryFinder.findTypeVariable(AuxiliaryFinder.java:293)
>         at org.apache.harmony.lang.reflect.parser.Parser.getGenericParameterTypes(Parser.java:742)
>         at java.lang.reflect.Method.getGenericParameterTypes(Method.java:110)
>         at Test.main(Test.java:10)
> FAIL: java.lang.NullPointerException
>         at org.apache.harmony.lang.reflect.support.AuxiliaryFinder.findTypeVariable(AuxiliaryFinder.java:293)
>         at org.apache.harmony.lang.reflect.parser.Parser.getGenericReturnTypeImpl(Parser.java:447)
>         at java.lang.reflect.Method.getGenericReturnType(Method.java:126)
>         at Test.main(Test.java:12)
> FAIL: java.lang.NullPointerException
>         at org.apache.harmony.lang.reflect.support.AuxiliaryFinder.findTypeVariable(AuxiliaryFinder.java:293)
>         at org.apache.harmony.lang.reflect.parser.Parser.getGenericParameterTypes(Parser.java:742)
>         at java.lang.reflect.Method.toGenericString(Method.java:150)
>         at Test.main(Test.java:18)
> FAILURE
> This issue is critical as it prevents Geronimo Deployer from working 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-5622) [drlvm][kernel][geronimo] Method.getGeneric*() methods throw NPE for parametrized interface methods

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

Vasily Zakharov updated HARMONY-5622:
-------------------------------------

    Attachment: Harmony-5622.patch

Attached a fix patch. It's rather big and contains the following changes:

1. Resolves the issue itself making sure the class is checked for null before getTypeParameters() is called.

2. Redesigns the findGenericDeclarationForTypeVariable() by unifying the handling for Class, Field, Method and Constructor wherever possible and moving parts of functionality to a separate hasGenericDeclaration() method.

3. Redesigns the findTypeVariable() method by unifying the handling for Class, Field, Method and Constructor wherever possible and moving parts of functionality to a separate findTypeVariableInDeclaration() method.

4. Fixes a number of minor formatting issues like no space between 'if' or 'for' and (, or between ) and {.

As a result of changes 2 and 3 the patched file is half that big as original one.

The patch was checked briefly but not thoroughly, so it's just a draft for now. I'll check it more carefully later.

I would be grateful if someone from VM gurus reviews the patch. Thank you!


> [drlvm][kernel][geronimo] Method.getGeneric*() methods throw NPE for parametrized interface methods
> ---------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5622
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5622
>             Project: Harmony
>          Issue Type: Bug
>          Components: App-Oriented Bug Reports, DRLVM
>    Affects Versions: 5.0M5
>            Reporter: Vasily Zakharov
>            Assignee: Vasily Zakharov
>            Priority: Critical
>         Attachments: Harmony-5622.patch
>
>
> Class Method methods getGenericParameterTypes(), getGenericReturnType() and toGenericString() throw NPE if called for a parametrized method in an interface.
> Here's the test demonstrating the problem:
> import java.lang.reflect.Method;
> public class Test {
>     public static void main(String[] args) {
>         boolean success = true;
>         try {
>             Method method = Sample.class.getMethods()[0];
>             for (int i = 0; i < 5; i++) {
>                 try {
>                     switch (i) {
>                     case 0: method.getGenericParameterTypes();
>                             break;
>                     case 1: method.getGenericReturnType();
>                             break;
>                     case 2: method.getGenericExceptionTypes();
>                             break;
>                     case 3: method.getTypeParameters();
>                             break;
>                     case 4: method.toGenericString();
>                             break;
>                     }
>                 } catch (Exception e) {
>                     success = false;
>                     System.out.print("FAIL: ");
>                     e.printStackTrace(System.out);
>                 }
>             }
>             System.out.println(success ? "SUCCESS" : "FAILURE");
>         } catch (Exception e) {
>             System.out.print("ERROR: ");
>             e.printStackTrace(System.out);
>         }
>     }
> }
> interface Sample {
>     public <T extends Sample, E extends Throwable> T test(T param) throws E;
> }
> Output on RI:
> SUCCESS
> Output on Harmony:
> FAIL: java.lang.NullPointerException
>         at org.apache.harmony.lang.reflect.support.AuxiliaryFinder.findTypeVariable(AuxiliaryFinder.java:293)
>         at org.apache.harmony.lang.reflect.parser.Parser.getGenericParameterTypes(Parser.java:742)
>         at java.lang.reflect.Method.getGenericParameterTypes(Method.java:110)
>         at Test.main(Test.java:10)
> FAIL: java.lang.NullPointerException
>         at org.apache.harmony.lang.reflect.support.AuxiliaryFinder.findTypeVariable(AuxiliaryFinder.java:293)
>         at org.apache.harmony.lang.reflect.parser.Parser.getGenericReturnTypeImpl(Parser.java:447)
>         at java.lang.reflect.Method.getGenericReturnType(Method.java:126)
>         at Test.main(Test.java:12)
> FAIL: java.lang.NullPointerException
>         at org.apache.harmony.lang.reflect.support.AuxiliaryFinder.findTypeVariable(AuxiliaryFinder.java:293)
>         at org.apache.harmony.lang.reflect.parser.Parser.getGenericParameterTypes(Parser.java:742)
>         at java.lang.reflect.Method.toGenericString(Method.java:150)
>         at Test.main(Test.java:18)
> FAILURE
> This issue is critical as it prevents Geronimo Deployer from working 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-5622) [drlvm][kernel][geronimo] Method.getGeneric*() methods throw NPE for parametrized interface methods

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

Vasily Zakharov reassigned HARMONY-5622:
----------------------------------------

    Assignee: Vasily Zakharov

> [drlvm][kernel][geronimo] Method.getGeneric*() methods throw NPE for parametrized interface methods
> ---------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5622
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5622
>             Project: Harmony
>          Issue Type: Bug
>          Components: App-Oriented Bug Reports, DRLVM
>    Affects Versions: 5.0M5
>            Reporter: Vasily Zakharov
>            Assignee: Vasily Zakharov
>            Priority: Critical
>
> Class Method methods getGenericParameterTypes(), getGenericReturnType() and toGenericString() throw NPE if called for a parametrized method in an interface.
> Here's the test demonstrating the problem:
> import java.lang.reflect.Method;
> public class Test {
>     public static void main(String[] args) {
>         boolean success = true;
>         try {
>             Method method = Sample.class.getMethods()[0];
>             for (int i = 0; i < 5; i++) {
>                 try {
>                     switch (i) {
>                     case 0: method.getGenericParameterTypes();
>                             break;
>                     case 1: method.getGenericReturnType();
>                             break;
>                     case 2: method.getGenericExceptionTypes();
>                             break;
>                     case 3: method.getTypeParameters();
>                             break;
>                     case 4: method.toGenericString();
>                             break;
>                     }
>                 } catch (Exception e) {
>                     success = false;
>                     System.out.print("FAIL: ");
>                     e.printStackTrace(System.out);
>                 }
>             }
>             System.out.println(success ? "SUCCESS" : "FAILURE");
>         } catch (Exception e) {
>             System.out.print("ERROR: ");
>             e.printStackTrace(System.out);
>         }
>     }
> }
> interface Sample {
>     public <T extends Sample, E extends Throwable> T test(T param) throws E;
> }
> Output on RI:
> SUCCESS
> Output on Harmony:
> FAIL: java.lang.NullPointerException
>         at org.apache.harmony.lang.reflect.support.AuxiliaryFinder.findTypeVariable(AuxiliaryFinder.java:293)
>         at org.apache.harmony.lang.reflect.parser.Parser.getGenericParameterTypes(Parser.java:742)
>         at java.lang.reflect.Method.getGenericParameterTypes(Method.java:110)
>         at Test.main(Test.java:10)
> FAIL: java.lang.NullPointerException
>         at org.apache.harmony.lang.reflect.support.AuxiliaryFinder.findTypeVariable(AuxiliaryFinder.java:293)
>         at org.apache.harmony.lang.reflect.parser.Parser.getGenericReturnTypeImpl(Parser.java:447)
>         at java.lang.reflect.Method.getGenericReturnType(Method.java:126)
>         at Test.main(Test.java:12)
> FAIL: java.lang.NullPointerException
>         at org.apache.harmony.lang.reflect.support.AuxiliaryFinder.findTypeVariable(AuxiliaryFinder.java:293)
>         at org.apache.harmony.lang.reflect.parser.Parser.getGenericParameterTypes(Parser.java:742)
>         at java.lang.reflect.Method.toGenericString(Method.java:150)
>         at Test.main(Test.java:18)
> FAILURE
> This issue is critical as it prevents Geronimo Deployer from working 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-5622) [drlvm][kernel][geronimo] Method.getGeneric*() methods throw NPE for parametrized interface methods

Posted by "Alexey Varlamov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-5622?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12581011#action_12581011 ] 

Alexey Varlamov commented on HARMONY-5622:
------------------------------------------

Vasily, the patch looks generally correct. But what a funny original code - looks like heavily premature loop unrolling optimization applied (or guy was accustomed to be paid per NSLOCs ;)
Few notes:
1) This code is java5 specific so would benefit from using sintactic sugars like "Enhanced for Loop";
2) I'm confused with inconsistent usage of method "transform" - probably it was a bug in original code. It was used only for Method/Constructor operations in findTypeVariable(), and not used at all in findGenericDeclarationForTypeVariable(). Anyway transforming a string for every comparison in a loop is unwise - ideally callers of respective method should care about it, or at least param should be transformed just once.

> [drlvm][kernel][geronimo] Method.getGeneric*() methods throw NPE for parametrized interface methods
> ---------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5622
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5622
>             Project: Harmony
>          Issue Type: Bug
>          Components: App-Oriented Bug Reports, DRLVM
>    Affects Versions: 5.0M5
>            Reporter: Vasily Zakharov
>            Assignee: Vasily Zakharov
>            Priority: Critical
>         Attachments: Harmony-5622.patch
>
>
> Class Method methods getGenericParameterTypes(), getGenericReturnType() and toGenericString() throw NPE if called for a parametrized method in an interface.
> Here's the test demonstrating the problem:
> import java.lang.reflect.Method;
> public class Test {
>     public static void main(String[] args) {
>         boolean success = true;
>         try {
>             Method method = Sample.class.getMethods()[0];
>             for (int i = 0; i < 5; i++) {
>                 try {
>                     switch (i) {
>                     case 0: method.getGenericParameterTypes();
>                             break;
>                     case 1: method.getGenericReturnType();
>                             break;
>                     case 2: method.getGenericExceptionTypes();
>                             break;
>                     case 3: method.getTypeParameters();
>                             break;
>                     case 4: method.toGenericString();
>                             break;
>                     }
>                 } catch (Exception e) {
>                     success = false;
>                     System.out.print("FAIL: ");
>                     e.printStackTrace(System.out);
>                 }
>             }
>             System.out.println(success ? "SUCCESS" : "FAILURE");
>         } catch (Exception e) {
>             System.out.print("ERROR: ");
>             e.printStackTrace(System.out);
>         }
>     }
> }
> interface Sample {
>     public <T extends Sample, E extends Throwable> T test(T param) throws E;
> }
> Output on RI:
> SUCCESS
> Output on Harmony:
> FAIL: java.lang.NullPointerException
>         at org.apache.harmony.lang.reflect.support.AuxiliaryFinder.findTypeVariable(AuxiliaryFinder.java:293)
>         at org.apache.harmony.lang.reflect.parser.Parser.getGenericParameterTypes(Parser.java:742)
>         at java.lang.reflect.Method.getGenericParameterTypes(Method.java:110)
>         at Test.main(Test.java:10)
> FAIL: java.lang.NullPointerException
>         at org.apache.harmony.lang.reflect.support.AuxiliaryFinder.findTypeVariable(AuxiliaryFinder.java:293)
>         at org.apache.harmony.lang.reflect.parser.Parser.getGenericReturnTypeImpl(Parser.java:447)
>         at java.lang.reflect.Method.getGenericReturnType(Method.java:126)
>         at Test.main(Test.java:12)
> FAIL: java.lang.NullPointerException
>         at org.apache.harmony.lang.reflect.support.AuxiliaryFinder.findTypeVariable(AuxiliaryFinder.java:293)
>         at org.apache.harmony.lang.reflect.parser.Parser.getGenericParameterTypes(Parser.java:742)
>         at java.lang.reflect.Method.toGenericString(Method.java:150)
>         at Test.main(Test.java:18)
> FAILURE
> This issue is critical as it prevents Geronimo Deployer from working 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-5622) [drlvm][kernel][geronimo] Method.getGeneric*() methods throw NPE for parametrized interface methods

Posted by "Alexey Varlamov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-5622?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12581785#action_12581785 ] 

Alexey Varlamov commented on HARMONY-5622:
------------------------------------------

Vasily, could you please add a regression testcase for this issue? 
I think it is better to add a testcase to kernel tests for this issue, rather than to regression suite.

> [drlvm][kernel][geronimo] Method.getGeneric*() methods throw NPE for parametrized interface methods
> ---------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5622
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5622
>             Project: Harmony
>          Issue Type: Bug
>          Components: App-Oriented Bug Reports, DRLVM
>    Affects Versions: 5.0M5
>            Reporter: Vasily Zakharov
>            Assignee: Vasily Zakharov
>            Priority: Critical
>             Fix For: 5.0M6
>
>         Attachments: Harmony-5622.patch, Harmony-5622.patch
>
>
> Class Method methods getGenericParameterTypes(), getGenericReturnType() and toGenericString() throw NPE if called for a parametrized method in an interface.
> Here's the test demonstrating the problem:
> import java.lang.reflect.Method;
> public class Test {
>     public static void main(String[] args) {
>         boolean success = true;
>         try {
>             Method method = Sample.class.getMethods()[0];
>             for (int i = 0; i < 5; i++) {
>                 try {
>                     switch (i) {
>                     case 0: method.getGenericParameterTypes();
>                             break;
>                     case 1: method.getGenericReturnType();
>                             break;
>                     case 2: method.getGenericExceptionTypes();
>                             break;
>                     case 3: method.getTypeParameters();
>                             break;
>                     case 4: method.toGenericString();
>                             break;
>                     }
>                 } catch (Exception e) {
>                     success = false;
>                     System.out.print("FAIL: ");
>                     e.printStackTrace(System.out);
>                 }
>             }
>             System.out.println(success ? "SUCCESS" : "FAILURE");
>         } catch (Exception e) {
>             System.out.print("ERROR: ");
>             e.printStackTrace(System.out);
>         }
>     }
> }
> interface Sample {
>     public <T extends Sample, E extends Throwable> T test(T param) throws E;
> }
> Output on RI:
> SUCCESS
> Output on Harmony:
> FAIL: java.lang.NullPointerException
>         at org.apache.harmony.lang.reflect.support.AuxiliaryFinder.findTypeVariable(AuxiliaryFinder.java:293)
>         at org.apache.harmony.lang.reflect.parser.Parser.getGenericParameterTypes(Parser.java:742)
>         at java.lang.reflect.Method.getGenericParameterTypes(Method.java:110)
>         at Test.main(Test.java:10)
> FAIL: java.lang.NullPointerException
>         at org.apache.harmony.lang.reflect.support.AuxiliaryFinder.findTypeVariable(AuxiliaryFinder.java:293)
>         at org.apache.harmony.lang.reflect.parser.Parser.getGenericReturnTypeImpl(Parser.java:447)
>         at java.lang.reflect.Method.getGenericReturnType(Method.java:126)
>         at Test.main(Test.java:12)
> FAIL: java.lang.NullPointerException
>         at org.apache.harmony.lang.reflect.support.AuxiliaryFinder.findTypeVariable(AuxiliaryFinder.java:293)
>         at org.apache.harmony.lang.reflect.parser.Parser.getGenericParameterTypes(Parser.java:742)
>         at java.lang.reflect.Method.toGenericString(Method.java:150)
>         at Test.main(Test.java:18)
> FAILURE
> This issue is critical as it prevents Geronimo Deployer from working 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-5622) [drlvm][kernel][geronimo] Method.getGeneric*() methods throw NPE for parametrized interface methods

Posted by "Alexey Varlamov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-5622?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12581480#action_12581480 ] 

Alexey Varlamov commented on HARMONY-5622:
------------------------------------------

Well, as long as the patch passes kernel tests it 's OK to commit.

> [drlvm][kernel][geronimo] Method.getGeneric*() methods throw NPE for parametrized interface methods
> ---------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5622
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5622
>             Project: Harmony
>          Issue Type: Bug
>          Components: App-Oriented Bug Reports, DRLVM
>    Affects Versions: 5.0M5
>            Reporter: Vasily Zakharov
>            Assignee: Vasily Zakharov
>            Priority: Critical
>         Attachments: Harmony-5622.patch, Harmony-5622.patch
>
>
> Class Method methods getGenericParameterTypes(), getGenericReturnType() and toGenericString() throw NPE if called for a parametrized method in an interface.
> Here's the test demonstrating the problem:
> import java.lang.reflect.Method;
> public class Test {
>     public static void main(String[] args) {
>         boolean success = true;
>         try {
>             Method method = Sample.class.getMethods()[0];
>             for (int i = 0; i < 5; i++) {
>                 try {
>                     switch (i) {
>                     case 0: method.getGenericParameterTypes();
>                             break;
>                     case 1: method.getGenericReturnType();
>                             break;
>                     case 2: method.getGenericExceptionTypes();
>                             break;
>                     case 3: method.getTypeParameters();
>                             break;
>                     case 4: method.toGenericString();
>                             break;
>                     }
>                 } catch (Exception e) {
>                     success = false;
>                     System.out.print("FAIL: ");
>                     e.printStackTrace(System.out);
>                 }
>             }
>             System.out.println(success ? "SUCCESS" : "FAILURE");
>         } catch (Exception e) {
>             System.out.print("ERROR: ");
>             e.printStackTrace(System.out);
>         }
>     }
> }
> interface Sample {
>     public <T extends Sample, E extends Throwable> T test(T param) throws E;
> }
> Output on RI:
> SUCCESS
> Output on Harmony:
> FAIL: java.lang.NullPointerException
>         at org.apache.harmony.lang.reflect.support.AuxiliaryFinder.findTypeVariable(AuxiliaryFinder.java:293)
>         at org.apache.harmony.lang.reflect.parser.Parser.getGenericParameterTypes(Parser.java:742)
>         at java.lang.reflect.Method.getGenericParameterTypes(Method.java:110)
>         at Test.main(Test.java:10)
> FAIL: java.lang.NullPointerException
>         at org.apache.harmony.lang.reflect.support.AuxiliaryFinder.findTypeVariable(AuxiliaryFinder.java:293)
>         at org.apache.harmony.lang.reflect.parser.Parser.getGenericReturnTypeImpl(Parser.java:447)
>         at java.lang.reflect.Method.getGenericReturnType(Method.java:126)
>         at Test.main(Test.java:12)
> FAIL: java.lang.NullPointerException
>         at org.apache.harmony.lang.reflect.support.AuxiliaryFinder.findTypeVariable(AuxiliaryFinder.java:293)
>         at org.apache.harmony.lang.reflect.parser.Parser.getGenericParameterTypes(Parser.java:742)
>         at java.lang.reflect.Method.toGenericString(Method.java:150)
>         at Test.main(Test.java:18)
> FAILURE
> This issue is critical as it prevents Geronimo Deployer from working 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-5622) [drlvm][kernel][geronimo] Method.getGeneric*() methods throw NPE for parametrized interface methods

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

Vasily Zakharov closed HARMONY-5622.
------------------------------------


Committed a regression test.

Closing the issue.


> [drlvm][kernel][geronimo] Method.getGeneric*() methods throw NPE for parametrized interface methods
> ---------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5622
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5622
>             Project: Harmony
>          Issue Type: Bug
>          Components: App-Oriented Bug Reports, DRLVM
>    Affects Versions: 5.0M5
>            Reporter: Vasily Zakharov
>            Assignee: Vasily Zakharov
>            Priority: Critical
>             Fix For: 5.0M6
>
>         Attachments: Harmony-5622.patch, Harmony-5622.patch
>
>
> Class Method methods getGenericParameterTypes(), getGenericReturnType() and toGenericString() throw NPE if called for a parametrized method in an interface.
> Here's the test demonstrating the problem:
> import java.lang.reflect.Method;
> public class Test {
>     public static void main(String[] args) {
>         boolean success = true;
>         try {
>             Method method = Sample.class.getMethods()[0];
>             for (int i = 0; i < 5; i++) {
>                 try {
>                     switch (i) {
>                     case 0: method.getGenericParameterTypes();
>                             break;
>                     case 1: method.getGenericReturnType();
>                             break;
>                     case 2: method.getGenericExceptionTypes();
>                             break;
>                     case 3: method.getTypeParameters();
>                             break;
>                     case 4: method.toGenericString();
>                             break;
>                     }
>                 } catch (Exception e) {
>                     success = false;
>                     System.out.print("FAIL: ");
>                     e.printStackTrace(System.out);
>                 }
>             }
>             System.out.println(success ? "SUCCESS" : "FAILURE");
>         } catch (Exception e) {
>             System.out.print("ERROR: ");
>             e.printStackTrace(System.out);
>         }
>     }
> }
> interface Sample {
>     public <T extends Sample, E extends Throwable> T test(T param) throws E;
> }
> Output on RI:
> SUCCESS
> Output on Harmony:
> FAIL: java.lang.NullPointerException
>         at org.apache.harmony.lang.reflect.support.AuxiliaryFinder.findTypeVariable(AuxiliaryFinder.java:293)
>         at org.apache.harmony.lang.reflect.parser.Parser.getGenericParameterTypes(Parser.java:742)
>         at java.lang.reflect.Method.getGenericParameterTypes(Method.java:110)
>         at Test.main(Test.java:10)
> FAIL: java.lang.NullPointerException
>         at org.apache.harmony.lang.reflect.support.AuxiliaryFinder.findTypeVariable(AuxiliaryFinder.java:293)
>         at org.apache.harmony.lang.reflect.parser.Parser.getGenericReturnTypeImpl(Parser.java:447)
>         at java.lang.reflect.Method.getGenericReturnType(Method.java:126)
>         at Test.main(Test.java:12)
> FAIL: java.lang.NullPointerException
>         at org.apache.harmony.lang.reflect.support.AuxiliaryFinder.findTypeVariable(AuxiliaryFinder.java:293)
>         at org.apache.harmony.lang.reflect.parser.Parser.getGenericParameterTypes(Parser.java:742)
>         at java.lang.reflect.Method.toGenericString(Method.java:150)
>         at Test.main(Test.java:18)
> FAILURE
> This issue is critical as it prevents Geronimo Deployer from working 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-5622) [drlvm][kernel][geronimo] Method.getGeneric*() methods throw NPE for parametrized interface methods

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

Vasily Zakharov updated HARMONY-5622:
-------------------------------------

    Description: 
Class Method methods getGenericParameterTypes(), getGenericReturnType() and toGenericString() throw NPE if called for a parametrized method in an interface.

Here's the test demonstrating the problem:

import java.lang.reflect.Method;
public class Test {
    public static void main(String[] args) {
        boolean success = true;
        try {
            Method method = Sample.class.getMethods()[0];
            for (int i = 0; i < 5; i++) {
                try {
                    switch (i) {
                    case 0: method.getGenericParameterTypes();
                            break;
                    case 1: method.getGenericReturnType();
                            break;
                    case 2: method.getGenericExceptionTypes();
                            break;
                    case 3: method.getTypeParameters();
                            break;
                    case 4: method.toGenericString();
                            break;
                    }
                } catch (Exception e) {
                    success = false;
                    System.out.print("FAIL: ");
                    e.printStackTrace(System.out);
                }
            }
            System.out.println(success ? "SUCCESS" : "FAILURE");
        } catch (Exception e) {
            System.out.print("ERROR: ");
            e.printStackTrace(System.out);
        }
    }
}
interface Sample {
    public <T extends Sample, E extends Throwable> T test(T param) throws E;
}

Output on RI:

SUCCESS

Output on Harmony:

FAIL: java.lang.NullPointerException
        at org.apache.harmony.lang.reflect.support.AuxiliaryFinder.findTypeVariable(AuxiliaryFinder.java:293)
        at org.apache.harmony.lang.reflect.parser.Parser.getGenericParameterTypes(Parser.java:742)
        at java.lang.reflect.Method.getGenericParameterTypes(Method.java:110)
        at Test.main(Test.java:10)
FAIL: java.lang.NullPointerException
        at org.apache.harmony.lang.reflect.support.AuxiliaryFinder.findTypeVariable(AuxiliaryFinder.java:293)
        at org.apache.harmony.lang.reflect.parser.Parser.getGenericReturnTypeImpl(Parser.java:447)
        at java.lang.reflect.Method.getGenericReturnType(Method.java:126)
        at Test.main(Test.java:12)
FAIL: java.lang.NullPointerException
        at org.apache.harmony.lang.reflect.support.AuxiliaryFinder.findTypeVariable(AuxiliaryFinder.java:293)
        at org.apache.harmony.lang.reflect.parser.Parser.getGenericParameterTypes(Parser.java:742)
        at java.lang.reflect.Method.toGenericString(Method.java:150)
        at Test.main(Test.java:18)
FAILURE

This issue is critical as it prevents Geronimo Deployer from working on Harmony.


  was:
Class Method methods getGenericParameterTypes(), getGenericReturnType() and toGenericString() throw NPE if called for a parametrized method.

Here's the test demonstrating the problem:

import java.lang.reflect.Method;
public class Test {
    public static void main(String[] args) {
        boolean success = true;
        try {
            Method method = Sample.class.getMethods()[0];
            for (int i = 0; i < 5; i++) {
                try {
                    switch (i) {
                    case 0: method.getGenericParameterTypes();
                            break;
                    case 1: method.getGenericReturnType();
                            break;
                    case 2: method.getGenericExceptionTypes();
                            break;
                    case 3: method.getTypeParameters();
                            break;
                    case 4: method.toGenericString();
                            break;
                    }
                } catch (Exception e) {
                    success = false;
                    System.out.print("FAIL: ");
                    e.printStackTrace(System.out);
                }
            }
            System.out.println(success ? "SUCCESS" : "FAILURE");
        } catch (Exception e) {
            System.out.print("ERROR: ");
            e.printStackTrace(System.out);
        }
    }
}
interface Sample {
    public <T extends Sample, E extends Throwable> T test(T param) throws E;
}

Output on RI:

SUCCESS

Output on Harmony:

FAIL: java.lang.NullPointerException
        at org.apache.harmony.lang.reflect.support.AuxiliaryFinder.findTypeVariable(AuxiliaryFinder.java:293)
        at org.apache.harmony.lang.reflect.parser.Parser.getGenericParameterTypes(Parser.java:742)
        at java.lang.reflect.Method.getGenericParameterTypes(Method.java:110)
        at Test.main(Test.java:10)
FAIL: java.lang.NullPointerException
        at org.apache.harmony.lang.reflect.support.AuxiliaryFinder.findTypeVariable(AuxiliaryFinder.java:293)
        at org.apache.harmony.lang.reflect.parser.Parser.getGenericReturnTypeImpl(Parser.java:447)
        at java.lang.reflect.Method.getGenericReturnType(Method.java:126)
        at Test.main(Test.java:12)
FAIL: java.lang.NullPointerException
        at org.apache.harmony.lang.reflect.support.AuxiliaryFinder.findTypeVariable(AuxiliaryFinder.java:293)
        at org.apache.harmony.lang.reflect.parser.Parser.getGenericParameterTypes(Parser.java:742)
        at java.lang.reflect.Method.toGenericString(Method.java:150)
        at Test.main(Test.java:18)
FAILURE

This issue is critical as it prevents Geronimo Deployer from working on Harmony.


        Summary: [drlvm][kernel][geronimo] Method.getGeneric*() methods throw NPE for parametrized interface methods  (was: [drlvm][kernel][geronimo] Method.getGeneric*() methods throw NPE)

> [drlvm][kernel][geronimo] Method.getGeneric*() methods throw NPE for parametrized interface methods
> ---------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5622
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5622
>             Project: Harmony
>          Issue Type: Bug
>          Components: App-Oriented Bug Reports, DRLVM
>    Affects Versions: 5.0M5
>            Reporter: Vasily Zakharov
>            Priority: Critical
>
> Class Method methods getGenericParameterTypes(), getGenericReturnType() and toGenericString() throw NPE if called for a parametrized method in an interface.
> Here's the test demonstrating the problem:
> import java.lang.reflect.Method;
> public class Test {
>     public static void main(String[] args) {
>         boolean success = true;
>         try {
>             Method method = Sample.class.getMethods()[0];
>             for (int i = 0; i < 5; i++) {
>                 try {
>                     switch (i) {
>                     case 0: method.getGenericParameterTypes();
>                             break;
>                     case 1: method.getGenericReturnType();
>                             break;
>                     case 2: method.getGenericExceptionTypes();
>                             break;
>                     case 3: method.getTypeParameters();
>                             break;
>                     case 4: method.toGenericString();
>                             break;
>                     }
>                 } catch (Exception e) {
>                     success = false;
>                     System.out.print("FAIL: ");
>                     e.printStackTrace(System.out);
>                 }
>             }
>             System.out.println(success ? "SUCCESS" : "FAILURE");
>         } catch (Exception e) {
>             System.out.print("ERROR: ");
>             e.printStackTrace(System.out);
>         }
>     }
> }
> interface Sample {
>     public <T extends Sample, E extends Throwable> T test(T param) throws E;
> }
> Output on RI:
> SUCCESS
> Output on Harmony:
> FAIL: java.lang.NullPointerException
>         at org.apache.harmony.lang.reflect.support.AuxiliaryFinder.findTypeVariable(AuxiliaryFinder.java:293)
>         at org.apache.harmony.lang.reflect.parser.Parser.getGenericParameterTypes(Parser.java:742)
>         at java.lang.reflect.Method.getGenericParameterTypes(Method.java:110)
>         at Test.main(Test.java:10)
> FAIL: java.lang.NullPointerException
>         at org.apache.harmony.lang.reflect.support.AuxiliaryFinder.findTypeVariable(AuxiliaryFinder.java:293)
>         at org.apache.harmony.lang.reflect.parser.Parser.getGenericReturnTypeImpl(Parser.java:447)
>         at java.lang.reflect.Method.getGenericReturnType(Method.java:126)
>         at Test.main(Test.java:12)
> FAIL: java.lang.NullPointerException
>         at org.apache.harmony.lang.reflect.support.AuxiliaryFinder.findTypeVariable(AuxiliaryFinder.java:293)
>         at org.apache.harmony.lang.reflect.parser.Parser.getGenericParameterTypes(Parser.java:742)
>         at java.lang.reflect.Method.toGenericString(Method.java:150)
>         at Test.main(Test.java:18)
> FAILURE
> This issue is critical as it prevents Geronimo Deployer from working 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-5622) [drlvm][kernel][geronimo] Method.getGeneric*() methods throw NPE for parametrized interface methods

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

Vasily Zakharov commented on HARMONY-5622:
------------------------------------------

It turned out that the regression test causes a StackOverflowError thrown if run with the default stack size on Windows/64/Interpreter.

So I've removed the regression test from the kernel test suite and now working on including the test to regression test suite that provides the capability to specify an increased stack size for the particular test.


> [drlvm][kernel][geronimo] Method.getGeneric*() methods throw NPE for parametrized interface methods
> ---------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5622
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5622
>             Project: Harmony
>          Issue Type: Bug
>          Components: App-Oriented Bug Reports, DRLVM
>    Affects Versions: 5.0M5
>            Reporter: Vasily Zakharov
>            Assignee: Vasily Zakharov
>            Priority: Critical
>             Fix For: 5.0M6
>
>         Attachments: Harmony-5622.patch, Harmony-5622.patch
>
>
> Class Method methods getGenericParameterTypes(), getGenericReturnType() and toGenericString() throw NPE if called for a parametrized method in an interface.
> Here's the test demonstrating the problem:
> import java.lang.reflect.Method;
> public class Test {
>     public static void main(String[] args) {
>         boolean success = true;
>         try {
>             Method method = Sample.class.getMethods()[0];
>             for (int i = 0; i < 5; i++) {
>                 try {
>                     switch (i) {
>                     case 0: method.getGenericParameterTypes();
>                             break;
>                     case 1: method.getGenericReturnType();
>                             break;
>                     case 2: method.getGenericExceptionTypes();
>                             break;
>                     case 3: method.getTypeParameters();
>                             break;
>                     case 4: method.toGenericString();
>                             break;
>                     }
>                 } catch (Exception e) {
>                     success = false;
>                     System.out.print("FAIL: ");
>                     e.printStackTrace(System.out);
>                 }
>             }
>             System.out.println(success ? "SUCCESS" : "FAILURE");
>         } catch (Exception e) {
>             System.out.print("ERROR: ");
>             e.printStackTrace(System.out);
>         }
>     }
> }
> interface Sample {
>     public <T extends Sample, E extends Throwable> T test(T param) throws E;
> }
> Output on RI:
> SUCCESS
> Output on Harmony:
> FAIL: java.lang.NullPointerException
>         at org.apache.harmony.lang.reflect.support.AuxiliaryFinder.findTypeVariable(AuxiliaryFinder.java:293)
>         at org.apache.harmony.lang.reflect.parser.Parser.getGenericParameterTypes(Parser.java:742)
>         at java.lang.reflect.Method.getGenericParameterTypes(Method.java:110)
>         at Test.main(Test.java:10)
> FAIL: java.lang.NullPointerException
>         at org.apache.harmony.lang.reflect.support.AuxiliaryFinder.findTypeVariable(AuxiliaryFinder.java:293)
>         at org.apache.harmony.lang.reflect.parser.Parser.getGenericReturnTypeImpl(Parser.java:447)
>         at java.lang.reflect.Method.getGenericReturnType(Method.java:126)
>         at Test.main(Test.java:12)
> FAIL: java.lang.NullPointerException
>         at org.apache.harmony.lang.reflect.support.AuxiliaryFinder.findTypeVariable(AuxiliaryFinder.java:293)
>         at org.apache.harmony.lang.reflect.parser.Parser.getGenericParameterTypes(Parser.java:742)
>         at java.lang.reflect.Method.toGenericString(Method.java:150)
>         at Test.main(Test.java:18)
> FAILURE
> This issue is critical as it prevents Geronimo Deployer from working 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-5622) [drlvm][kernel][geronimo] Method.getGeneric*() methods throw NPE for parametrized interface methods

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

Vasily Zakharov commented on HARMONY-5622:
------------------------------------------

It seems the problem is at AuxiliaryFinder, lines 287-294:

287: while (klass != null) {
288:     klass = klass.getDeclaringClass();
293:     va = klass.getTypeParameters();   <-- NPE is thrown
294:     if (va != null) {

Clearly enough, a null check like the one at line 287 should occur between lines 288 and 293.


> [drlvm][kernel][geronimo] Method.getGeneric*() methods throw NPE for parametrized interface methods
> ---------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5622
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5622
>             Project: Harmony
>          Issue Type: Bug
>          Components: App-Oriented Bug Reports, DRLVM
>    Affects Versions: 5.0M5
>            Reporter: Vasily Zakharov
>            Priority: Critical
>
> Class Method methods getGenericParameterTypes(), getGenericReturnType() and toGenericString() throw NPE if called for a parametrized method in an interface.
> Here's the test demonstrating the problem:
> import java.lang.reflect.Method;
> public class Test {
>     public static void main(String[] args) {
>         boolean success = true;
>         try {
>             Method method = Sample.class.getMethods()[0];
>             for (int i = 0; i < 5; i++) {
>                 try {
>                     switch (i) {
>                     case 0: method.getGenericParameterTypes();
>                             break;
>                     case 1: method.getGenericReturnType();
>                             break;
>                     case 2: method.getGenericExceptionTypes();
>                             break;
>                     case 3: method.getTypeParameters();
>                             break;
>                     case 4: method.toGenericString();
>                             break;
>                     }
>                 } catch (Exception e) {
>                     success = false;
>                     System.out.print("FAIL: ");
>                     e.printStackTrace(System.out);
>                 }
>             }
>             System.out.println(success ? "SUCCESS" : "FAILURE");
>         } catch (Exception e) {
>             System.out.print("ERROR: ");
>             e.printStackTrace(System.out);
>         }
>     }
> }
> interface Sample {
>     public <T extends Sample, E extends Throwable> T test(T param) throws E;
> }
> Output on RI:
> SUCCESS
> Output on Harmony:
> FAIL: java.lang.NullPointerException
>         at org.apache.harmony.lang.reflect.support.AuxiliaryFinder.findTypeVariable(AuxiliaryFinder.java:293)
>         at org.apache.harmony.lang.reflect.parser.Parser.getGenericParameterTypes(Parser.java:742)
>         at java.lang.reflect.Method.getGenericParameterTypes(Method.java:110)
>         at Test.main(Test.java:10)
> FAIL: java.lang.NullPointerException
>         at org.apache.harmony.lang.reflect.support.AuxiliaryFinder.findTypeVariable(AuxiliaryFinder.java:293)
>         at org.apache.harmony.lang.reflect.parser.Parser.getGenericReturnTypeImpl(Parser.java:447)
>         at java.lang.reflect.Method.getGenericReturnType(Method.java:126)
>         at Test.main(Test.java:12)
> FAIL: java.lang.NullPointerException
>         at org.apache.harmony.lang.reflect.support.AuxiliaryFinder.findTypeVariable(AuxiliaryFinder.java:293)
>         at org.apache.harmony.lang.reflect.parser.Parser.getGenericParameterTypes(Parser.java:742)
>         at java.lang.reflect.Method.toGenericString(Method.java:150)
>         at Test.main(Test.java:18)
> FAILURE
> This issue is critical as it prevents Geronimo Deployer from working 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-5622) [drlvm][kernel][geronimo] Method.getGeneric*() methods throw NPE for parametrized interface methods

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

Vasily Zakharov resolved HARMONY-5622.
--------------------------------------

       Resolution: Fixed
    Fix Version/s: 5.0M6

Patch applied.


> [drlvm][kernel][geronimo] Method.getGeneric*() methods throw NPE for parametrized interface methods
> ---------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5622
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5622
>             Project: Harmony
>          Issue Type: Bug
>          Components: App-Oriented Bug Reports, DRLVM
>    Affects Versions: 5.0M5
>            Reporter: Vasily Zakharov
>            Assignee: Vasily Zakharov
>            Priority: Critical
>             Fix For: 5.0M6
>
>         Attachments: Harmony-5622.patch, Harmony-5622.patch
>
>
> Class Method methods getGenericParameterTypes(), getGenericReturnType() and toGenericString() throw NPE if called for a parametrized method in an interface.
> Here's the test demonstrating the problem:
> import java.lang.reflect.Method;
> public class Test {
>     public static void main(String[] args) {
>         boolean success = true;
>         try {
>             Method method = Sample.class.getMethods()[0];
>             for (int i = 0; i < 5; i++) {
>                 try {
>                     switch (i) {
>                     case 0: method.getGenericParameterTypes();
>                             break;
>                     case 1: method.getGenericReturnType();
>                             break;
>                     case 2: method.getGenericExceptionTypes();
>                             break;
>                     case 3: method.getTypeParameters();
>                             break;
>                     case 4: method.toGenericString();
>                             break;
>                     }
>                 } catch (Exception e) {
>                     success = false;
>                     System.out.print("FAIL: ");
>                     e.printStackTrace(System.out);
>                 }
>             }
>             System.out.println(success ? "SUCCESS" : "FAILURE");
>         } catch (Exception e) {
>             System.out.print("ERROR: ");
>             e.printStackTrace(System.out);
>         }
>     }
> }
> interface Sample {
>     public <T extends Sample, E extends Throwable> T test(T param) throws E;
> }
> Output on RI:
> SUCCESS
> Output on Harmony:
> FAIL: java.lang.NullPointerException
>         at org.apache.harmony.lang.reflect.support.AuxiliaryFinder.findTypeVariable(AuxiliaryFinder.java:293)
>         at org.apache.harmony.lang.reflect.parser.Parser.getGenericParameterTypes(Parser.java:742)
>         at java.lang.reflect.Method.getGenericParameterTypes(Method.java:110)
>         at Test.main(Test.java:10)
> FAIL: java.lang.NullPointerException
>         at org.apache.harmony.lang.reflect.support.AuxiliaryFinder.findTypeVariable(AuxiliaryFinder.java:293)
>         at org.apache.harmony.lang.reflect.parser.Parser.getGenericReturnTypeImpl(Parser.java:447)
>         at java.lang.reflect.Method.getGenericReturnType(Method.java:126)
>         at Test.main(Test.java:12)
> FAIL: java.lang.NullPointerException
>         at org.apache.harmony.lang.reflect.support.AuxiliaryFinder.findTypeVariable(AuxiliaryFinder.java:293)
>         at org.apache.harmony.lang.reflect.parser.Parser.getGenericParameterTypes(Parser.java:742)
>         at java.lang.reflect.Method.toGenericString(Method.java:150)
>         at Test.main(Test.java:18)
> FAILURE
> This issue is critical as it prevents Geronimo Deployer from working 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-5622) [drlvm][kernel][geronimo] Method.getGeneric*() methods throw NPE for parametrized interface methods

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

Vasily Zakharov commented on HARMONY-5622:
------------------------------------------

Yes, the original code is very strange, and that's what pushed me to rewrite it.
Thanks for you suggestions, I'll update the patch.
As of 'transform' method, it's completely confusing me. Finding out what was intentional and what a bug is difficult. Hopefully I've made the right choice.
Thanks!


> [drlvm][kernel][geronimo] Method.getGeneric*() methods throw NPE for parametrized interface methods
> ---------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5622
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5622
>             Project: Harmony
>          Issue Type: Bug
>          Components: App-Oriented Bug Reports, DRLVM
>    Affects Versions: 5.0M5
>            Reporter: Vasily Zakharov
>            Assignee: Vasily Zakharov
>            Priority: Critical
>         Attachments: Harmony-5622.patch
>
>
> Class Method methods getGenericParameterTypes(), getGenericReturnType() and toGenericString() throw NPE if called for a parametrized method in an interface.
> Here's the test demonstrating the problem:
> import java.lang.reflect.Method;
> public class Test {
>     public static void main(String[] args) {
>         boolean success = true;
>         try {
>             Method method = Sample.class.getMethods()[0];
>             for (int i = 0; i < 5; i++) {
>                 try {
>                     switch (i) {
>                     case 0: method.getGenericParameterTypes();
>                             break;
>                     case 1: method.getGenericReturnType();
>                             break;
>                     case 2: method.getGenericExceptionTypes();
>                             break;
>                     case 3: method.getTypeParameters();
>                             break;
>                     case 4: method.toGenericString();
>                             break;
>                     }
>                 } catch (Exception e) {
>                     success = false;
>                     System.out.print("FAIL: ");
>                     e.printStackTrace(System.out);
>                 }
>             }
>             System.out.println(success ? "SUCCESS" : "FAILURE");
>         } catch (Exception e) {
>             System.out.print("ERROR: ");
>             e.printStackTrace(System.out);
>         }
>     }
> }
> interface Sample {
>     public <T extends Sample, E extends Throwable> T test(T param) throws E;
> }
> Output on RI:
> SUCCESS
> Output on Harmony:
> FAIL: java.lang.NullPointerException
>         at org.apache.harmony.lang.reflect.support.AuxiliaryFinder.findTypeVariable(AuxiliaryFinder.java:293)
>         at org.apache.harmony.lang.reflect.parser.Parser.getGenericParameterTypes(Parser.java:742)
>         at java.lang.reflect.Method.getGenericParameterTypes(Method.java:110)
>         at Test.main(Test.java:10)
> FAIL: java.lang.NullPointerException
>         at org.apache.harmony.lang.reflect.support.AuxiliaryFinder.findTypeVariable(AuxiliaryFinder.java:293)
>         at org.apache.harmony.lang.reflect.parser.Parser.getGenericReturnTypeImpl(Parser.java:447)
>         at java.lang.reflect.Method.getGenericReturnType(Method.java:126)
>         at Test.main(Test.java:12)
> FAIL: java.lang.NullPointerException
>         at org.apache.harmony.lang.reflect.support.AuxiliaryFinder.findTypeVariable(AuxiliaryFinder.java:293)
>         at org.apache.harmony.lang.reflect.parser.Parser.getGenericParameterTypes(Parser.java:742)
>         at java.lang.reflect.Method.toGenericString(Method.java:150)
>         at Test.main(Test.java:18)
> FAILURE
> This issue is critical as it prevents Geronimo Deployer from working on Harmony.

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