Esempio n. 1
0
 /// <summary>
 /// Resolve the given java based type reference to a Cecil based type reference.
 /// </summary>
 internal static bool TryResolve(this TypeReference jRef, TargetFramework target, IBuilderGenericContext gcontext, bool convertSignedBytes, out NetTypeReference result)
 {
     result = null;
     if (jRef.IsArray)
     {
         var aType = (ArrayTypeReference)jRef;
         NetTypeReference elementType;
         if (!aType.ElementType.TryResolve(target, gcontext, convertSignedBytes, out elementType))
         {
             return(false);
         }
         result = new NetArrayType(elementType);
         return(true);
     }
     if (jRef.IsVoid)
     {
         result = target.TypeNameMap.GetByType(typeof(void));
         return(true);
     }
     if (jRef.IsBaseType)
     {
         var bType = (BaseTypeReference)jRef;
         result = target.TypeNameMap.GetByType(bType.GetClrType(convertSignedBytes));
         return(true);
     }
     if (jRef.IsObjectType)
     {
         return(TryResolveObjectType((ObjectTypeReference)jRef, target, gcontext, out result));
     }
     if (jRef.IsTypeVariable)
     {
         var tRef = (TypeVariableReference)jRef;
         if (gcontext.TryResolveTypeParameter(tRef.ClassName, target, out result))
         {
             return(true);
         }
         result = target.TypeNameMap.Object; // Hack for incorrect behaving java classes
         return(true);
     }
     return(false);
     //throw new ArgumentException(string.Format("Unknown java type ref. {0}", jRef));
 }
Esempio n. 2
0
 /// <summary>
 /// Resolve the given java based type reference to a Cecil based type reference.
 /// </summary>
 internal static bool TryResolve(this TypeReference jRef, TargetFramework target, IBuilderGenericContext gcontext, bool convertSignedBytes, out NetTypeReference result)
 {
     result = null;
     if (jRef.IsArray)
     {
         var aType = (ArrayTypeReference) jRef;
         NetTypeReference elementType;
         if (!aType.ElementType.TryResolve(target, gcontext, convertSignedBytes, out elementType))
             return false;
         result = new NetArrayType(elementType);
         return true;
     }
     if (jRef.IsVoid)
     {
         result = target.TypeNameMap.GetByType(typeof(void));
         return true;
     }
     if (jRef.IsBaseType)
     {
         var bType = (BaseTypeReference) jRef;
         result = target.TypeNameMap.GetByType(bType.GetClrType(convertSignedBytes));
         return true;
     }
     if (jRef.IsObjectType)
     {
         return TryResolveObjectType((ObjectTypeReference) jRef, target, gcontext, out result);
     }
     if (jRef.IsTypeVariable)
     {
         var tRef = (TypeVariableReference) jRef;
         if (gcontext.TryResolveTypeParameter(tRef.ClassName, target, out result))
             return true;
         result = target.TypeNameMap.Object; // Hack for incorrect behaving java classes
         return true;
     }
     return false;
     //throw new ArgumentException(string.Format("Unknown java type ref. {0}", jRef));
 }
Esempio n. 3
0
 public bool Visit(NetArrayType item, INetMemberVisibility member)
 {
     return(item.ElementType.Accept(this, member));
 }
Esempio n. 4
0
 public string Visit(NetArrayType item, bool addDummyGeneric)
 {
     return(item.ElementType.Accept(this, true) + "[]");
 }
Esempio n. 5
0
 /// <summary>
 /// Resolve an array type.
 /// </summary>
 public NetTypeReference Visit(NetArrayType item, int data)
 {
     return(new NetArrayType(item.ElementType.Accept(this, data)));
 }