You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Tim Ellison (JIRA)" <ji...@apache.org> on 2008/04/24 16:47:24 UTC
[jira] Updated: (HARMONY-5783) [drlvm][kernel] Flaky behavior of
getGenericParameterTypes
[ https://issues.apache.org/jira/browse/HARMONY-5783?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Tim Ellison updated HARMONY-5783:
---------------------------------
Summary: [drlvm][kernel] Flaky behavior of getGenericParameterTypes (was: Flaky behavior of getGenericParameterTypes)
> [drlvm][kernel] Flaky behavior of getGenericParameterTypes
> ----------------------------------------------------------
>
> Key: HARMONY-5783
> URL: https://issues.apache.org/jira/browse/HARMONY-5783
> Project: Harmony
> Issue Type: Bug
> Components: DRLVM
> Reporter: Davanum Srinivas
>
> Checked in a totally ugly HACK to work around this issue. Basically the problem shows up only when we run the full test harness, works fine when i run a single test even under maven.
> http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/impl/ParameterDescriptionImplTests.java?r1=650884&r2=650883&pathrev=650884
> BAD Case:
> >>>> Method: public abstract java.lang.String org.apache.axis2.jaxws.description.impl.TestInterface.method2(javax.xml.ws.Holder)
> >>>> javax.xml.ws.Holder<java.lang.String>
> >>>> 5 :class java.lang.String
> Good Case:
> >>>> Method: public abstract java.lang.String TestInterface.method2(javax.xml.ws.Holder)
> >>>> javax.xml.ws.Holder<java.lang.String[]>
> >>>> 3 :class java.lang.String
> >>>> 4 :class [Ljava.lang.String;
> Stripped down test (Works fine when run stand alone, fails as part of maven test harness)
> import javax.xml.ws.Holder;
> import java.lang.reflect.Array;
> import java.lang.reflect.GenericArrayType;
> import java.lang.reflect.Method;
> import java.lang.reflect.ParameterizedType;
> import java.lang.reflect.Type;
> import java.util.List;
> public class Main {
> public static void main(String[] args) throws Exception {
> Method[] methods = TestInterface.class.getMethods();
> Method method2 = null;
> for (int i = 0; i < methods.length; i++) {
> if(methods[i].getName().equals("method2")){
> method2 = methods[i];
> }
> }
> System.out.println(">>>> Method: " + method2);
> Type type2 = method2.getGenericParameterTypes()[0];
> if (ParameterizedType.class.isInstance(type2)) {
> ParameterizedType parameterGenericType = (ParameterizedType) type2;
> System.out.println(">>>> " + parameterGenericType);
> if (parameterGenericType != null &&
> parameterGenericType.getRawType() == javax.xml.ws.Holder.class) {
> Type type = parameterGenericType.getActualTypeArguments()[0];
> if (type != null && ParameterizedType.class.isInstance(type)) {
> // For types of Holder<Generic<K,V>>, return class associated with Generic
> System.out.println(">>>> 1 :" + (Class) ((ParameterizedType) type).getRawType());
> return;
> } else if (type != null && GenericArrayType.class.isInstance(type)) {
> Type componentType = ((GenericArrayType) type).getGenericComponentType();
> Class arrayClass = null;
> if (ParameterizedType.class.isInstance(componentType)) {
> // For types of Holder<Generic<K,V>[]>, return class associated with Generic[]
> arrayClass = (Class) ((ParameterizedType) componentType).getRawType();
> System.out.println(">>>> 2 :" + arrayClass);
> } else {
> // For types of Holder<Object[]>, return class associated with Object[]
> arrayClass = (Class) componentType;
> System.out.println(">>>> 3 :" + arrayClass);
> }
> // REVIEW: This only works for a single dimension array! Note that if this method is removed
> // when DBC is used, just make sure DBC supports multi-dim arrays
> System.out.println(">>>> 4 :" + Array.newInstance(arrayClass, 0).getClass());
> return;
> } else {
> // For types of Holder<Object>, return the class associated with Object
> System.out.println(">>>> 5 :" + (Class) type);
> return;
> }
> }
> }
> }
>
> }
> interface TestInterface {
> String method1(Holder<List<String>[]> foo);
> String method2(Holder<String[]> foo);
> String method3(Holder<List<?>[]> foo);
> String method4(String[] foo);
> String method5(List<String>[] foo);
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.