예제 #1
0
 public static X10JavaSerializable $_deserialize_body(
     RuntimeType rt, X10JavaDeserializer deserializer) throws IOException {
   short classId = deserializer.readSerializationId();
   Class<?> clazz = deserializer.getClassForID(classId);
   rt.javaClass = clazz;
   rt.numParams = deserializer.readByte();
   // TODO parents needed?
   return rt;
 }
예제 #2
0
 private static String typeName(Class<?> javaClass) {
   RuntimeType<?> rtt = null;
   if (javaClass.isArray()) {
     return X10_INTEROP_JAVA_ARRAY + "[" + typeName(javaClass.getComponentType()) + "]";
   } else if ((rtt = Types.getRTTForKnownType(javaClass)) != null) {
     return rtt.typeName();
   } else {
     return javaClass.getName();
   }
 }
예제 #3
0
 // check "subType and subParams" <: "this and thisParams"
 final boolean isAssignableFrom(
     Type<?>[] thisParams, RuntimeType<?> subType, Type<?>[] subParams) {
   if (javaClass == subType.getJavaClass()) {
     if (thisParams != null) {
       for (int i = 0, s = thisParams.length; i < s; i++) {
         Variance variance;
         Type<?> subParam;
         Type<?> thisParam;
         variance = getVariance(i);
         subParam = subParams[i];
         thisParam = thisParams[i];
         if (!subtypeTestForParam(variance, thisParam, subParam)) {
           return false;
         }
       }
     }
     return true;
   } else if (javaClass.isAssignableFrom(subType.getJavaClass())) {
     return instantiateCheck(thisParams, subType, subParams);
   } else {
     return false;
   }
 }