harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From var...@apache.org
Subject svn commit: r650815 - in /harmony/enhanced/drlvm/trunk/vm: tests/kernel/java/lang/ vmcore/src/kernel_classes/javasrc/org/apache/harmony/lang/reflect/parser/
Date Wed, 23 Apr 2008 10:22:57 GMT
Author: varlax
Date: Wed Apr 23 03:22:51 2008
New Revision: 650815

URL: http://svn.apache.org/viewvc?rev=650815&view=rev
Log:
Fixed HARMONY-5752 [drlvm][kernel] java.lang.reflect.GenericSignatureFormatError running xjc
tool in JAXB RI

Modified:
    harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/Class1_5Test.java
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/org/apache/harmony/lang/reflect/parser/SignatureLexer2.java
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/org/apache/harmony/lang/reflect/parser/SignatureParser.java

Modified: harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/Class1_5Test.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/Class1_5Test.java?rev=650815&r1=650814&r2=650815&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/Class1_5Test.java (original)
+++ harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/Class1_5Test.java Wed Apr 23 03:22:51
2008
@@ -27,6 +27,9 @@
 import java.lang.annotation.Documented;
 import java.lang.annotation.Retention;
 import java.lang.annotation.Target;
+import java.lang.reflect.GenericArrayType;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
 
 /*
  * Created on 28.05.2005
@@ -497,6 +500,33 @@
                        e3.class.getGenericSuperclass().toString()
                            .indexOf("e2") == -1);
 		}
+        
+        static final class BC1 extends AC1<String, byte[]>{} 
+        static final class BC2 extends AC1<byte[][], Byte>{}
+        static abstract class AC1<ValueType, BoundType> {} 
+
+        /**
+         * A regression test for HARMONY-5752 
+         */
+        public void testGenericSupeclass_h5752() throws Exception {
+            Type t1 = BC1.class.getGenericSuperclass();
+            assertTrue("t1", t1 instanceof ParameterizedType);
+            Type[] args1 = ((ParameterizedType)t1).getActualTypeArguments();
+            assertEquals("num params t1", 2, args1.length);
+            assertEquals("1 param t1", String.class, args1[0]);
+            assertTrue("2 param t1 type", args1[1] instanceof GenericArrayType);
+            assertEquals("2 param t1", byte.class, ((GenericArrayType)args1[1]).getGenericComponentType());
+
+            Type t2 = BC2.class.getGenericSuperclass();
+            assertTrue("t2", t2 instanceof ParameterizedType);
+            Type[] args2 = ((ParameterizedType)t2).getActualTypeArguments();
+            assertEquals("num params t2", 2, args2.length);
+            assertTrue("2 param t2 type", args2[0] instanceof GenericArrayType);
+            Type at2 = ((GenericArrayType)args2[0]).getGenericComponentType();
+            assertTrue("2 param t2 type2", at2 instanceof GenericArrayType);
+            assertEquals("2 param t2", byte.class, ((GenericArrayType)at2).getGenericComponentType());
+            assertEquals("2 param t2", Byte.class, args2[1]);
+        }
 
 		/**
 		 *  

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/org/apache/harmony/lang/reflect/parser/SignatureLexer2.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/org/apache/harmony/lang/reflect/parser/SignatureLexer2.java?rev=650815&r1=650814&r2=650815&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/org/apache/harmony/lang/reflect/parser/SignatureLexer2.java
(original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/org/apache/harmony/lang/reflect/parser/SignatureLexer2.java
Wed Apr 23 03:22:51 2008
@@ -238,7 +238,7 @@
                 case 'I':  case 'J':
                 case 'S':  case 'Z':
                 {
-                    if (Lflag2 == 1 && Lflag3 != 1) {
+                    if (Lflag2 == 1 && Lflag3 != 1 || prevLexeme == SQUAREOPEN_SIGN)
{
                         if (DEBUGGING) {
                             System.out.println(".............lex:TBASE: \""+ String.valueOf(sgntr.charAt(ind))+"\"");
                         }

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/org/apache/harmony/lang/reflect/parser/SignatureParser.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/org/apache/harmony/lang/reflect/parser/SignatureParser.java?rev=650815&r1=650814&r2=650815&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/org/apache/harmony/lang/reflect/parser/SignatureParser.java
(original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/org/apache/harmony/lang/reflect/parser/SignatureParser.java
Wed Apr 23 03:22:51 2008
@@ -97,6 +97,7 @@
     int  sigEnd;         // finish of the signature of the current nested parameterized type
within CTPTsignature
     int dim;             // to indicate the number of consequent "[" symbols. ATTENTION:
it used for all types: TVAR, TBASE, RETURN_BASE_TYPE, class type, parameterized type
     PTStack nextLevel;
+    boolean pendingTypeArg; // crutch to fix HARMONY-5752
 };
 private PTStack stack;
 private PTStack currentStackElem; // points to the current processed level element of the
nested parameterized types chain
@@ -177,7 +178,7 @@
     methParamList.add((InterimType)ref);
 }
 private void addElemToTypeArgsList(InterimType ref) {
-    prntS("      addElemToTypeArgsList");
+    prntS("      addElemToTypeArgsList: " + ref);
 
     // find the previous element for the current stack's element:
      PTStack p1 = stack, p2 = null;
@@ -1848,6 +1849,10 @@
 				if ( inputState.guessing==0 ) {
 					prntSS("   pr__TYPE_ARGUMENT 2 :", "m40.getText()");
 				}
+                if (currentStackElem.pendingTypeArg) {
+                    addElemToTypeArgsList(highLevelType);
+                    currentStackElem.pendingTypeArg = false;
+                }
 				break;
 			}
 			case PLUS_SIGN:
@@ -1968,6 +1973,7 @@
 					}
 					}
 					currentStackElem.dim = 0;
+                    currentStackElem.pendingTypeArg = true;
 					
 					highLevelType = /*(InterimGenericType)*/(InterimType)prsrT;
 					
@@ -2418,7 +2424,7 @@
 					prntS("      ===30===");  
 					// put base type into the method params list:
 					addElemToMethParamList(highLevelType);
-					
+                    currentStackElem.pendingTypeArg = false;
 					highLevelType = null;
 					
 					prntSS("   pr__PARAMETER 1 :", "m79.getText()");



Mime
View raw message