[Mono-devel-list] CS0146: Class definition is circular

Chris Turchin chris at turchin.net
Wed Jan 28 20:05:37 EST 2004


Hi all,

I have been trying to get Lucene.Net
(http://sourceforge.net/projects/lucenedotnet) to compile in mono with
mcs and am stumbling over the following compiler error:

Store/Lock.cs(41) error CS0146: Class definition is circular:
`Lucene.Net.Store.Lock.With'
Index/IndexReader.cs(124) error CS0117: `Lucene.Net.Store.Lock' does not
contain a definition for `With'
...

The relavant code looks like this (method implementations elided for
clarity):

using System;
using System.Threading;
using System.IO;
using Lucene.Net.Index;

namespace Lucene.Net.Store
{
	public abstract class Lock 
	{
		public static int LOCK_POLL_INTERVAL = 1000;
		 
		public abstract bool Obtain();
		public bool Obtain(long lockWaitTimeout)
		{
		...
		}

		public abstract void Release();

		public abstract bool IsLocked();

		public abstract class With 
		{
			private Lock _lock;
			private long lockWaitTimeout;
    
			public With(Lock _lock): this(_lock, IndexWriter.COMMIT_LOCK_TIMEOUT)
			{}

			public With(Lock _lock, long lockWaitTimeout)
			{
				this._lock = _lock;
				this.lockWaitTimeout = lockWaitTimeout;	
			}

			public abstract Object DoBody();

			public Object Run()  
			{
			...
			}
		}
	}
}

Is this code really a problem? I thought a circular reference was
something like this:

class A : B {}
class B : A {}

and not what is going on above. At any rate, MS.NET seems to like it... 

Should I file a bug report or am I doing something wrong here?

Regards,
--chris



More information about the Mono-devel-list mailing list