Updated: 3/13/2003; 2:20:46 PM.
IKVM.NET Weblog
The development of a Java VM for .NET
        

Friday, December 13, 2002
This weblog has moved to http://weblog.ikvm.net/

The server hosting www.frijters.net seems to be having problems. For the time being the source and binaries can be downloaded here: source, binaries.

UPDATE: server is back up again.


7:37:56 PM    Comments
This weblog has moved to http://weblog.ikvm.net/

Interesting post by Chris Daly on the advanced-dotnet list today. He questions the C# language spec, which says that the following is illegal:

public class A
{
protected int x;
}
public class B: A
{
static void F(A a, B b) {
a.x = 1; // Error, must access through instance of B
b.x = 1; // Ok
}

The equivalent Java is legal. When I statically compile the Java equivalent of A and B into two different assemblies, to resulting B.dll is unverifiable. It's not just a C# language issue, the CLR restricts access to protected members in this way. When both types are compiled into the same assembly there is no problem, because protected is compiled as famorassem so any type in the assembly already has access (this is needed because protected also implies package access, which has no CLR equivalent).

I wonder if a work around is required.

UPDATE: I wasn't quite awake yet. Of course, the reason that the above code works in Java is because protected implies package access, it has nothing to do with the protectness of the field. When you move A and B into different packages, javac fails with the same error as the C# compiler.


2:32:21 PM    Comments

© Copyright 2003 Jeroen Frijters.
 
December 2002
Sun Mon Tue Wed Thu Fri Sat
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31        
Nov   Jan