示例#1
0
        public void UnionCachePath(AppendableCachePath cachePath, AppendableCachePath other)
        {
            CHashSet <AppendableCachePath> otherChildren = other.children;

            if (otherChildren == null)
            {
                // fast case 1
                return;
            }
            CHashSet <AppendableCachePath> children = cachePath.children;

            if (children == null)
            {
                // fast case 2
                cachePath.children = otherChildren;
                return;
            }
            foreach (AppendableCachePath otherCachePath in otherChildren)
            {
                if (children.Add(otherCachePath))
                {
                    continue;
                }
                UnionCachePath(children.Get(otherCachePath), otherCachePath);
            }
        }
 static AbstractBeanConfiguration()
 {
     //ignoreClassNames.Add(Thread.class.getName());
     ignoreClassNames.Add(typeof(AbstractBeanConfiguration).FullName);
     ignoreClassNames.Add(typeof(AbstractPropertyConfiguration).FullName);
     ignoreClassNames.Add(typeof(BeanConfiguration).FullName);
     ignoreClassNames.Add(typeof(BeanContextFactory).FullName);
     ignoreClassNames.Add(typeof(BeanInstanceConfiguration).FullName);
     ignoreClassNames.Add(typeof(BeanRuntime <>).FullName);
     ignoreClassNames.Add(typeof(LinkConfiguration <>).FullName);
     ignoreClassNames.Add(typeof(LinkController).FullName);
     ignoreClassNames.Add(typeof(ServiceContext).FullName);
 }
示例#3
0
        public IServiceResult GetORIsOfService(IServiceDescription serviceDescription, ExecuteServiceDelegate executeServiceDelegate)
        {
            if (!UseResultCache)
            {
                return(executeServiceDelegate.Invoke(serviceDescription));
            }
            ServiceResultCacheKey key = BuildKey(serviceDescription);
            IServiceResult        serviceResult;

            lock (serviceCallToPendingResult)
            {
                serviceResult = serviceCallToResult.Get(key);
                if (serviceResult != null)
                {
                    return(CreateServiceResult(serviceResult));
                }
                while (serviceCallToPendingResult.Contains(key))
                {
                    Monitor.Wait(serviceCallToPendingResult);
                }
                serviceResult = serviceCallToResult.Get(key);
                if (serviceResult != null)
                {
                    return(CreateServiceResult(serviceResult));
                }
                serviceCallToPendingResult.Add(key);
            }
            bool success = false;

            try
            {
                if (SecurityActivation != null)
                {
                    serviceResult = SecurityActivation.ExecuteWithoutFiltering(new IResultingBackgroundWorkerDelegate <IServiceResult>(delegate()
                    {
                        return(executeServiceDelegate.Invoke(serviceDescription));
                    }));
                }
                else
                {
                    serviceResult = executeServiceDelegate.Invoke(serviceDescription);
                }
                success = true;
            }
            finally
            {
                lock (serviceCallToPendingResult)
                {
                    serviceCallToPendingResult.Remove(key);

                    if (success)
                    {
                        serviceCallToResult.Put(key, serviceResult);
                    }
                    Monitor.PulseAll(serviceCallToPendingResult);
                }
            }
            return(CreateServiceResult(serviceResult));
        }
示例#4
0
文件: StartUp.cs 项目: Ivorankov/DSA
        static void Main()
        {
            var hashSet = new CHashSet<int>();

            hashSet.Add(1);
            hashSet.Add(1);
            hashSet.Add(2);
            hashSet.Add(1);

            foreach (var item in hashSet)
            {
                Console.Write(item + " ");
            }

            Console.WriteLine();
            hashSet.Remove(1);

            foreach (var item in hashSet)
            {
                Console.Write(item + " ");
            }

            Console.WriteLine();
            var secondHashSet = new CHashSet<int>();
            secondHashSet.Add(3);
            secondHashSet.Add(4);
            secondHashSet.Add(2);

            var unionTest = hashSet.Union(secondHashSet);

            foreach (var item in unionTest)
            {
                Console.Write(item + " ");
            }

            Console.WriteLine();
            var intersectTest = hashSet.Intersect(secondHashSet);

            foreach (var item in intersectTest)
            {
                Console.Write(item + " ");
            }
        }
示例#5
0
        public override void Visit(TypeAttributes access, String name, Type superName, Type[] interfaces)
        {
            Type originalType = State.OriginalType;

            access &= ~TypeAttributes.Abstract;
            access &= ~TypeAttributes.Interface;
            if (originalType.IsInterface)
            {
                CHashSet <Type> interfaceSet = new CHashSet <Type>(interfaces);
                interfaceSet.Add(originalType);
                interfaces = interfaceSet.ToArray();
            }
            base.Visit(access, name, superName, interfaces);
        }
示例#6
0
        protected void CleanupSecondLevelCaches(CacheDependencyNode node, IList <IObjRef> deletesList, IList <IDataChangeEntry> updates,
                                                CHashSet <Type> occuringTypes)
        {
            List <IObjRef> objRefsRemovePriorVersions = new List <IObjRef>(updates.Count);

            for (int a = updates.Count; a-- > 0;)
            {
                IDataChangeEntry updateEntry = updates[a];
                Type             entityType  = updateEntry.EntityType;
                occuringTypes.Add(entityType);
                objRefsRemovePriorVersions.Add(new ObjRef(entityType, updateEntry.IdNameIndex, updateEntry.Id, updateEntry.Version));
            }
            CleanupSecondLevelCachesIntern(node, deletesList, objRefsRemovePriorVersions);
        }
示例#7
0
        public PrefetchPath CopyAppendableToCachePath(AppendableCachePath cachePath)
        {
            PrefetchPath[] clonedChildren = CopyAppendableToCachePath(cachePath.children);
            if (clonedChildren == null)
            {
                return(new PrefetchPath(cachePath.memberType, cachePath.memberIndex, cachePath.memberName, clonedChildren, new Type[0]));
            }
            CHashSet <Type> memberTypesOnDescendants = new CHashSet <Type>();

            foreach (PrefetchPath clonedChild in clonedChildren)
            {
                memberTypesOnDescendants.Add(clonedChild.memberType);
                memberTypesOnDescendants.AddAll(clonedChild.memberTypesOnDescendants);
            }
            return(new PrefetchPath(cachePath.memberType, cachePath.memberIndex, cachePath.memberName, clonedChildren,
                                    memberTypesOnDescendants.ToArray()));
        }
        static AbstractPropertyConfiguration()
        {
            //ignoreClassNames.Add(typeof(Thread)..class.getName());
            ignoreClassNames.Add(typeof(AbstractPropertyConfiguration).FullName);
            ignoreClassNames.Add(typeof(BeanContextFactory).FullName);
            ignoreClassNames.Add(typeof(LinkController).FullName);
            ignoreClassNames.Add(typeof(PropertyEmbeddedRefConfiguration).FullName);
            ignoreClassNames.Add(typeof(PropertyRefConfiguration).FullName);
            ignoreClassNames.Add(typeof(PropertyValueConfiguration).FullName);

            ignoreClassNames.AddAll(AbstractBeanConfiguration.ignoreClassNames);
        }
示例#9
0
        public AppendableCachePath CopyCachePathToAppendable(PrefetchPath cachePath)
        {
            PrefetchPath[] children = cachePath.children;
            CHashSet <AppendableCachePath> clonedChildren = null;

            if (children != null)
            {
                clonedChildren = CHashSet <AppendableCachePath> .Create(children.Length);

                for (int a = children.Length; a-- > 0;)
                {
                    clonedChildren.Add(CopyCachePathToAppendable(children[a]));
                }
            }
            AppendableCachePath clonedCachePath = new AppendableCachePath(cachePath.memberType, cachePath.memberIndex, cachePath.memberName);

            clonedCachePath.children = clonedChildren;
            return(clonedCachePath);
        }
示例#10
0
        public ISet <IObjRef> lookForIntermediateDeletes()
        {
            CHashSet <IObjRef> intermediateDeletes = new CHashSet <IObjRef>();
            // Hold cache values as hard ref to prohibit cache loss due to GC
            IList <IObjRef> hardRefRequest = hardRefObjRefsToLoad.ToList();
            IList <Object>  hardRefResult  = rootCache.GetObjects(hardRefRequest, cacheValueResultAndReturnMissesSet);

            for (int a = hardRefResult.Count; a-- > 0;)
            {
                Object hardRef = hardRefResult[a];
                if (hardRef != null)
                {
                    continue;
                }
                // Objects are marked as UPDATED in the DCE, but could not be newly retrieved from the server
                // This occurs if a fast DELETE event on the server happened but has not been processed, yet
                IObjRef hardRefObjRefToLoad = hardRefRequest[a];
                intermediateDeletes.Add(hardRefObjRefToLoad);
            }
            this.privilegedHardRefResult = hardRefResult;
            RemoveNotFoundObjRefs(intermediateDeletes.ToArray());

            return(intermediateDeletes);
        }
示例#11
0
        protected Type CreateGpType(AccessorClassLoader loader, Type proxyType, Type[] additionalProxyTypes, String className)
        {
            String classNameInternal = className.Replace('.', '/');
            Type   abstractType      = typeof(GCProxy);

            List <Type> interfaceClasses = new List <Type>();

            interfaceClasses.Add(proxyType);
            foreach (Type additionalProxyType in additionalProxyTypes)
            {
                interfaceClasses.Add(additionalProxyType);
            }

            TypeBuilder cw = loader.CreateNewType(TypeAttributes.Public, classNameInternal, abstractType, Type.EmptyTypes);
            {
                ConstructorInfo baseConstructor = abstractType.GetConstructor(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[] { typeof(Object), typeof(IDisposable) }, null);
                if (baseConstructor == null)
                {
                    throw new Exception("Constructor not found: " + abstractType.FullName);
                }
                ILGenerator mv = cw.DefineConstructor(MethodAttributes.Public, CallingConventions.HasThis, TypeUtil.GetParameterTypesToTypes(baseConstructor.GetParameters())).GetILGenerator();
                mv.Emit(OpCodes.Ldarg_0);
                mv.Emit(OpCodes.Ldarg_1);
                mv.Emit(OpCodes.Ldarg_2);
                mv.Emit(OpCodes.Call, baseConstructor);
                mv.Emit(OpCodes.Ret);
            }
            {
                ConstructorInfo baseConstructor = abstractType.GetConstructor(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[] { typeof(IDisposable) }, null);
                if (baseConstructor == null)
                {
                    throw new Exception("Constructor not found: " + abstractType.FullName);
                }
                ILGenerator mv = cw.DefineConstructor(MethodAttributes.Public, CallingConventions.HasThis, TypeUtil.GetParameterTypesToTypes(baseConstructor.GetParameters())).GetILGenerator();
                mv.Emit(OpCodes.Ldarg_0);
                mv.Emit(OpCodes.Ldarg_1);
                mv.Emit(OpCodes.Call, baseConstructor);
                mv.Emit(OpCodes.Ret);
            }
            MethodInfo targetMethod = ReflectUtil.GetDeclaredMethod(false, typeof(GCProxy), typeof(Object), "ResolveTarget");

            CHashSet <MethodInfo> alreadyImplementedMethods = new CHashSet <MethodInfo>();

            foreach (Type interfaceClass in interfaceClasses)
            {
                MethodInfo[] methods = interfaceClass.GetMethods();
                foreach (MethodInfo method in methods)
                {
                    if (GCProxy.disposeMethod.Equals(method))
                    {
                        // will remain implemented by the GCProxy class
                        continue;
                    }
                    if (!alreadyImplementedMethods.Add(method))
                    {
                        continue;
                    }
                    MethodAttributes attributes = 0;

                    Type[]      paramTypes = TypeUtil.GetParameterTypesToTypes(method.GetParameters());
                    ILGenerator mv         = cw.DefineMethod(method.Name, attributes, CallingConventions.HasThis, method.ReturnType, paramTypes).GetILGenerator();
                    mv.Emit(OpCodes.Ldarg_0);
                    mv.Emit(OpCodes.Callvirt, targetMethod);
                    mv.Emit(OpCodes.Castclass, method.DeclaringType);
                    for (int a = 0, size = paramTypes.Length; a < size; a++)
                    {
                        mv.Emit(OpCodes.Ldarg, a + 1);
                    }
                    mv.Emit(OpCodes.Callvirt, method);
                    mv.Emit(OpCodes.Ret);
                }
            }
            return(loader.GetType(classNameInternal, cw));
        }
示例#12
0
        protected IOriCollection Intern(ICUDResult cudResult, IMethodDescription methodDescription, IList <MergeOperation> mergeOperationSequence,
                                        IncrementalMergeState state)
        {
            IList <IChangeContainer> allChanges   = cudResult.AllChanges;
            IList <Object>           originalRefs = cudResult.GetOriginalRefs();
            IdentityHashMap <IChangeContainer, int> changeToChangeIndexDict = new IdentityHashMap <IChangeContainer, int>();

            for (int a = allChanges.Count; a-- > 0;)
            {
                changeToChangeIndexDict.Put(allChanges[a], a);
            }
            IObjRef[] objRefs      = new IObjRef[allChanges.Count];
            long[]    allChangedOn = new long[allChanges.Count];
            String[]  allChangedBy = new String[allChanges.Count];

            CHashSet <long>   changedOnSet = new CHashSet <long>();
            CHashSet <String> changedBySet = new CHashSet <String>();

            for (int a = 0, size = mergeOperationSequence.Count; a < size; a++)
            {
                MergeOperation         mergeOperation        = mergeOperationSequence[a];
                IMergeServiceExtension mergeServiceExtension = mergeOperation.MergeServiceExtension;

                IList <IChangeContainer> changesForMergeService = mergeOperation.ChangeContainer;
                ICUDResult msCudResult = BuildCUDResult(changesForMergeService, changeToChangeIndexDict, originalRefs);

                IOriCollection msOriCollection = mergeServiceExtension.Merge(msCudResult, methodDescription);

                MergeController.ApplyChangesToOriginals(msCudResult, msOriCollection, state.GetStateCache());

                IList <IObjRef> allChangeORIs = msOriCollection.AllChangeORIs;

                long?  msDefaultChangedOn = msOriCollection.ChangedOn;
                String msDefaultChangedBy = msOriCollection.ChangedBy;

                long[]   msAllChangedOn = msOriCollection.AllChangedOn;
                String[] msAllChangedBy = msOriCollection.AllChangedBy;
                for (int b = changesForMergeService.Count; b-- > 0;)
                {
                    int index = changeToChangeIndexDict.Get(changesForMergeService[b]);
                    objRefs[index] = allChangeORIs[b];

                    if (msAllChangedOn != null)
                    {
                        long msChangedOn = msAllChangedOn[b];
                        allChangedOn[index] = msChangedOn;
                        changedOnSet.Add(msChangedOn);
                    }
                    else
                    {
                        allChangedOn[index] = msDefaultChangedOn.Value;
                    }
                    if (msAllChangedBy != null)
                    {
                        String msChangedBy = msAllChangedBy[b];
                        allChangedBy[index] = msChangedBy;
                        changedBySet.Add(msChangedBy);
                    }
                    else
                    {
                        allChangedBy[index] = msDefaultChangedBy;
                    }
                }
                if (msDefaultChangedOn != null)
                {
                    changedOnSet.Add(msDefaultChangedOn.Value);
                }
                if (msDefaultChangedBy != null)
                {
                    changedBySet.Add(msDefaultChangedBy);
                }
            }
            OriCollection oriCollection = new OriCollection();

            oriCollection.AllChangeORIs = new List <IObjRef>(objRefs);

            if (changedBySet.Count == 1)
            {
                Iterator <String> iter = changedBySet.Iterator();
                iter.MoveNext();
                oriCollection.ChangedBy = iter.Current;
            }
            else
            {
                oriCollection.AllChangedBy = allChangedBy;
            }
            if (changedOnSet.Count == 1)
            {
                Iterator <long> iter = changedOnSet.Iterator();
                iter.MoveNext();
                oriCollection.ChangedOn = iter.Current;
            }
            else
            {
                oriCollection.AllChangedOn = allChangedOn;
            }
            foreach (IMergeListener mergeListener in mergeListeners.GetExtensions())
            {
                mergeListener.PostMerge(cudResult, objRefs);
            }
            if (originalRefs != null)
            {
                // Set each original ref to null in order to suppress a post-processing in a potentially calling IMergeProcess
                for (int a = originalRefs.Count; a-- > 0;)
                {
                    originalRefs[a] = null;
                }
            }
            // TODO DCE must be fired HERE <---
            return(oriCollection);
        }
示例#13
0
        protected void DataChangedIntern(IDataChange dataChange, IList <Object> pausedEventTargets, IProcessResumeItem processResumeItem, CacheDependencyNode rootNode)
        {
            try
            {
                bool isLocalSource = dataChange.IsLocalSource;
                IList <IDataChangeEntry> deletes = dataChange.Deletes;
                IList <IDataChangeEntry> updates = dataChange.Updates;
                IList <IDataChangeEntry> inserts = dataChange.Inserts;

                CHashSet <Type>    occuringTypes       = new CHashSet <Type>();
                CHashSet <IObjRef> deletesSet          = new CHashSet <IObjRef>();
                CHashSet <Type>    directRelatingTypes = new CHashSet <Type>();
                bool acquirementSuccessful             = rootNode.rootCache.AcquireHardRefTLIfNotAlready();
                try
                {
                    for (int a = deletes.Count; a-- > 0;)
                    {
                        IDataChangeEntry deleteEntry = deletes[a];
                        Type             entityType  = deleteEntry.EntityType;
                        occuringTypes.Add(entityType);
                        if (deleteEntry is DirectDataChangeEntry)
                        {
                            // Ignore delete entries of unpersisted objects here
                            continue;
                        }
                        ObjRef tempORI = new ObjRef(entityType, deleteEntry.IdNameIndex, deleteEntry.Id, deleteEntry.Version);
                        deletesSet.Add(tempORI);
                    }
                    // Remove items from the cache only if they are really deleted/updates by a remote event
                    // And not 'simulated' by a local source
                    bool cleanupSecondLevelCaches = false;
                    if (pausedEventTargets != null && (deletes.Count > 0 || updates.Count > 0) && !isLocalSource)
                    {
                        cleanupSecondLevelCaches = true;
                    }
                    else if (updates.Count > 0)
                    {
                        for (int a = updates.Count; a-- > 0;)
                        {
                            IDataChangeEntry updateEntry = updates[a];
                            Type             entityType  = updateEntry.EntityType;
                            occuringTypes.Add(entityType);
                        }
                    }
                    for (int a = inserts.Count; a-- > 0;)
                    {
                        IDataChangeEntry insertEntry = inserts[a];
                        Type             entityType  = insertEntry.EntityType;
                        occuringTypes.Add(entityType);
                    }
                    EnsureMetaDataIsLoaded(occuringTypes, directRelatingTypes);

                    if (cleanupSecondLevelCaches)
                    {
                        CleanupSecondLevelCaches(rootNode, deletesSet.ToList(), updates, occuringTypes);
                    }

                    BuildCacheChangeItems(rootNode, dataChange);

                    rootNode.AggregateAllCascadedObjRefs();

                    ISet <IObjRef> intermediateDeletes = rootNode.lookForIntermediateDeletes();

                    ChangeSecondLevelCache(rootNode);

                    if (rootNode.IsPendingChangeOnAnyChildCache())
                    {
                        GuiThreadHelper.InvokeInGuiAndWait(delegate()
                        {
                            bool oldFailEarlyModeActive = AbstractCache.FailInCacheHierarchyModeActive;
                            AbstractCache.FailInCacheHierarchyModeActive = true;
                            try
                            {
                                ChangeFirstLevelCaches(rootNode, intermediateDeletes);
                            }
                            finally
                            {
                                AbstractCache.FailInCacheHierarchyModeActive = oldFailEarlyModeActive;
                            }
                        });
                    }
                }
                finally
                {
                    rootNode.rootCache.ClearHardRefs(acquirementSuccessful);
                }
            }
            finally
            {
                if (processResumeItem != null)
                {
                    processResumeItem.ResumeProcessingFinished();
                }
            }
        }
        /// <exception cref="Exception">Thrown when TargetField attribute cannot be found in the property</exception>
        /// <exception cref="InvalidOperationException">Thrown when try to invalid operation</exception>
        /// <summary>
        /// Create an interface implementation for dynamic type <paramref name="t"/>
        /// </summary>
        /// <typeparam name="T">Interface type</typeparam>
        /// <param name="t">
        /// Find only public static fields and methods
        /// Using static types(as opposed to dynamic types) is inefficient
        /// </param>
        /// <returns>Is not null if the method succeeds</returns>
        public static T Make <T>(Type t) where T : class
        {
            Type temp = typeof(T);

            if (!temp.IsInterface || temp.IsNotPublic || t == null || !(t.IsAbstract && t.IsSealed))
            {
                return(null);
            }
            if (cached.TryGetValue(t, out object obj))
            {
                return((T)obj);
            }

            PropertyInfo[] implPpt = temp.GetProperties(flag_i);
            SpMI[]         impl    = Array.ConvertAll(temp.GetMethods(flag_i), CONV_SPI);
            OnlyMI[]       code    = Array.ConvertAll(t.GetMethods(flag_s), CONV_OMI);

            int init_x = impl.Length;
            int init_p = implPpt.Length;

            if (init_x == 0 && init_p == 0)
            {
                return(null);
            }

            CHashSet <int> xdone =
                init_x == 0
                ? null
                : new CHashSet <int>(init_x);

            StringBuilder sb = new StringBuilder(t.FullName);

            sb.Append("__ClassWrapper__");
            sb.Append(cached.Count);

            TypeBuilder tb = mdb.DefineType(sb.ToString(), tattrb, null, new Type[1] {
                temp
            });

            int clen = code.Length;
            int z    = 0;

            for (; z < init_x; z++)
            {
                SilmMI k = impl[z];
                int    x = clen;

                while (--x >= 0)
                {
                    if (code[x].Equals(k) && xdone.Add(x))
                    {
                        SomeMethod(tb, k, code[x]);
                        break;
                    }
                }
            }
            if (xdone != null && init_x != xdone.Count)
            {
                throw new InvalidOperationException("Some methods could not be implemented", GETMOREINFO(temp, init_x, xdone));
            }

            for (z = 0; z < init_p; z++)
            {
                if (implPpt[z].GetCustomAttribute <TargetFieldAttribute>() is TargetFieldAttribute tfa)
                {
                    PropertyInfo pp = implPpt[z];
                    temp = pp.PropertyType;
                    if (tfa.refm ^ temp.IsByRef)
                    {
                        throw new InvalidOperationException("Incorrect attribute declare", GETMOREINFO(temp.IsByRef));
                    }
                    else if (pp.GetSetMethod() != null)
                    {
                        throw new InvalidOperationException("use ref return type instead of set accessor", GETMOREINFO());
                    }

                    if (t.GetField(pp.GetCustomAttribute <TargetFunctionAttribute>()?.name ?? tfa.name, flag_sa) is FieldInfo fd)
                    {
                        FieldMethod(tb, pp.GetGetMethod(false), fd, tfa.refm);
                    }
                    else
                    {
                        throw new InvalidOperationException($"Field not found: {tfa.name}");
                    }
                }
                else
                {
                    throw new Exception("Missing attribute");
                }
            }

            obj = FormatterServices.GetUninitializedObject(tb.CreateType());
            cached.Add(t, obj);

            return((T)obj);
        }
示例#15
0
        static ImmutableTypeSet()
        {
            wrapperTypesMap.Put(typeof(Int64?), typeof(Int64));
            wrapperTypesMap.Put(typeof(UInt64?), typeof(UInt64));
            wrapperTypesMap.Put(typeof(Int32?), typeof(Int32));
            wrapperTypesMap.Put(typeof(UInt32?), typeof(UInt32));
            wrapperTypesMap.Put(typeof(Int16?), typeof(Int16));
            wrapperTypesMap.Put(typeof(UInt16?), typeof(UInt16));
            wrapperTypesMap.Put(typeof(Byte?), typeof(Byte));
            wrapperTypesMap.Put(typeof(SByte?), typeof(SByte));
            wrapperTypesMap.Put(typeof(Double?), typeof(Double));
            wrapperTypesMap.Put(typeof(Single?), typeof(Single));
            wrapperTypesMap.Put(typeof(Char?), typeof(Char));
            wrapperTypesMap.Put(typeof(Boolean?), typeof(Boolean));

            immutableTypeSet.Add(typeof(Int64));
            immutableTypeSet.Add(typeof(Int64?));
            immutableTypeSet.Add(typeof(Int32));
            immutableTypeSet.Add(typeof(Int32?));
            immutableTypeSet.Add(typeof(Int16));
            immutableTypeSet.Add(typeof(Int16?));
            immutableTypeSet.Add(typeof(UInt64));
            immutableTypeSet.Add(typeof(UInt64?));
            immutableTypeSet.Add(typeof(UInt32));
            immutableTypeSet.Add(typeof(UInt32?));
            immutableTypeSet.Add(typeof(UInt16));
            immutableTypeSet.Add(typeof(UInt16?));
            immutableTypeSet.Add(typeof(Byte));
            immutableTypeSet.Add(typeof(Byte?));
            immutableTypeSet.Add(typeof(SByte));
            immutableTypeSet.Add(typeof(SByte?));
            immutableTypeSet.Add(typeof(Char));
            immutableTypeSet.Add(typeof(Char?));
            immutableTypeSet.Add(typeof(Boolean));
            immutableTypeSet.Add(typeof(Boolean?));
            immutableTypeSet.Add(typeof(Double));
            immutableTypeSet.Add(typeof(Double?));
            immutableTypeSet.Add(typeof(Single));
            immutableTypeSet.Add(typeof(Single?));
            immutableTypeSet.Add(typeof(String));
            immutableTypeSet.Add(typeof(Type));
            immutableTypeSet.Add(typeof(void));

            immutableTypeSet.Add(typeof(Regex));
            immutableTypeSet.Add(typeof(Uri));
            // In Java also: URL
            immutableTypeSet.Add(typeof(File));
        }