=== bin/janinoc
==================================================================
--- bin/janinoc	(revision 73237)
+++ bin/janinoc	(local)
@@ -5,8 +5,7 @@
 declare -a main_args;
 do_nothing=0;
 
-janino_jar=`dirname $0`/../lib/janino.jar;
-
+janino_jar=/home/fowles/janino/build/lib/janino.jar;
 while (( $# > 0 )); do
     arg=$1; shift;
     case $arg in
=== build.properties
==================================================================
--- build.properties	(revision 73237)
+++ build.properties	(local)
@@ -39,7 +39,7 @@
 src            = src
 build          = build
 javadoc        = javadoc
-jdk_1_2_2_home = c:/jdk-1.2.2
+jdk_1_2_2_home = /usr/lib/jvm/java-6-sun
 
 # files
 ant_jar    = c:/Programme/eclipse-3.3.2/plugins/org.apache.ant_1.7.0.v200706080842/lib/ant.jar
=== build.xml
==================================================================
--- build.xml	(revision 73237)
+++ build.xml	(local)
@@ -46,9 +46,9 @@
 			fork="yes"
 			executable="${jdk_1_2_2_home}/bin/javac"
 			srcdir="src" excludes="org/codehaus/janino/AstGeneratorVisitor.java"
+            target="1.5"
 			destdir="build/classes"
 			debug="true"
-			debuglevel="source"
 		/>
 	</target>
 
@@ -74,7 +74,12 @@
 		<mkdir dir="build/lib"/>
 		<jar jarfile="build/lib/janino.jar" basedir="build/classes"/>
 	</target>
- 
+
+ 	<target name="srcjar" description="Create the janino source jar.">
+		<mkdir dir="build/lib"/>
+		<jar jarfile="build/lib/janino-src.jar" basedir="src"/>
+	</target>
+
 	<target name="dist" description="Generate the distribution" depends="jar, javadoc">
 		<echo level="info">Signing jar: build/lib/janino.jar</echo>
 		<exec executable="jarsigner">
=== src/org/codehaus/janino/UnitCompiler.java
==================================================================
--- src/org/codehaus/janino/UnitCompiler.java	(revision 73237)
+++ src/org/codehaus/janino/UnitCompiler.java	(local)
@@ -37,6 +37,8 @@
 import java.io.DataOutputStream;
 import java.io.File;
 import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.StringWriter;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -4389,11 +4391,16 @@
         // At this point, the member is PROTECTED accessible.
 
         // Check whether the class declaring the context block statement is a subclass of the
-        // class declaring the member.
-        if (!iClassDeclaringMember.isAssignableFrom(iClassDeclaringContextBlockStatement)) {
-            return "Protected member cannot be accessed from type \"" + iClassDeclaringContextBlockStatement + "\", which is neither declared in the same package as nor is a subclass of \"" + iClassDeclaringMember + "\".";
-        }
-        return null;
+        // class declaring the member or a nested class whose parent is a subclass
+        IClass parentClass = iClassDeclaringContextBlockStatement;
+        do {
+            if (iClassDeclaringMember.isAssignableFrom(parentClass)) {
+                return null;
+            }
+            parentClass = parentClass.getOuterIClass();
+        } while(parentClass != null);
+        
+        return "Protected member cannot be accessed from type \"" + iClassDeclaringContextBlockStatement + "\", which is neither declared in the same package as nor is a subclass of \"" + iClassDeclaringMember + "\".";
     }
 
     /**
=== tests/src/EvaluatorTests.java
==================================================================
--- tests/src/EvaluatorTests.java	(revision 73237)
+++ tests/src/EvaluatorTests.java	(local)
@@ -53,6 +53,7 @@
         s.addTest(new EvaluatorTests("testGuessParameterNames"));
         s.addTest(new EvaluatorTests("testAssertNotCooked"));
         s.addTest(new EvaluatorTests("testAccessingCompilingClass"));
+        s.addTest(new EvaluatorTests("testProtectedAccessToParentSuperClassVar"));
         return s;
     }
 
@@ -249,4 +250,18 @@
         //the above loops become empty
         assertEquals(8, numTests);
     }
+    
+    public void testProtectedAccessToParentSuperClassVar() throws Exception {
+        SimpleCompiler sc = new SimpleCompiler();
+        sc.setParentClassLoader(SimpleCompiler.BOOT_CLASS_LOADER, new Class[] { for_sandbox_tests.ProtectedVariable.class });
+        sc.cook("package test;\n" +
+                "public class Top extends for_sandbox_tests.ProtectedVariable {\n" +
+                "    public class Inner {\n" +
+                "        public int get() {\n" +
+                "            return var;\n" +
+                "        }\n" +
+                "    } \n" +
+                "}"
+        );
+    }
 }
=== tests/src/for_sandbox_tests/ProtectedVariable.java
==================================================================
--- tests/src/for_sandbox_tests/ProtectedVariable.java	(revision 73237)
+++ tests/src/for_sandbox_tests/ProtectedVariable.java	(local)
@@ -0,0 +1,5 @@
+package for_sandbox_tests;
+
+public class ProtectedVariable {
+    protected int var = 1;
+}

