Index: common-build.xml
===================================================================
--- common-build.xml	(revision 477003)
+++ common-build.xml	(working copy)
@@ -28,8 +28,15 @@
 
   <property name="javac.deprecation" value="off"/>
   <property name="javac.debug" value="on"/>
+
+  <!-- if the value of javac.source is modified, then 
+       src/bad-bootloader-test/BadBootclasspathTest.java must be
+       modified in some way that is valid Java syntax for
+       ${java.source} but is not a valid class refrence
+   -->
   <property name="javac.source" value="1.4"/>
   <property name="javac.target" value="1.4"/>
+  <property name="javac.bootclasspath" value=""/>
 
   <property name="project.name" value="site"/> <!-- todo: is this used by anakia or something else? -->
   <property name="build.encoding" value="utf-8"/>
@@ -80,9 +87,52 @@
     </echo>
   </target>
 
-  <target name="init" depends="javacc-uptodate-check, javacc-notice">
+  <target name="init" depends="javac-check, javacc-uptodate-check, javacc-notice">
   </target>
 
+  <target name="javac-check" unless="javac.trustbootclasspath">
+    
+    <mkdir dir="${build.dir}/classes/bad-bootclasspath-test" />
+    <compile
+      failonerror="false"
+      srcdir="src/bad-bootclasspath-test"
+      destdir="${build.dir}/classes/bad-bootclasspath-test">
+    </compile>
+    <available
+      file="${build.dir}/classes/bad-bootclasspath-test/BadBootclasspathTest.class"
+      property="bootclasspath.bad"
+    />
+    <delete file="${build.dir}/classes/bad-bootclasspath-test/BadBootclasspathTest.class" />
+    <fail if="bootclasspath.bad">
+
+      ##################################################################
+      JavaC Bootclasspath is not restrictive enough
+      JavaC Bootclasspath:  ${javac.bootclasspath}
+      JavaC Source Version: ${javac.source}
+
+      The Lucene build system has detected that your current Java
+      Compiler recognizes classes which are "too new" for the Java
+      version the Lucene Project is currently targetting
+      (${javac.source}).  This means that any source modifications you
+      make *may* include features added since Java ${javac.source}
+      and would not be compitable.
+
+      You should either:
+        A) Compile Lucene with a Java ${javac.source} Compiler
+
+        B) Set the "javac.bootclasspath" property for ant (either
+           on the command line using -Djavac.bootclasspath=... or in a
+           build.properties file) to point at copy of the rt.jar
+           which corrisponds with Java ${javac.source}.
+
+        C) Set the "javac.trustbootclasspath" property to force the
+           Lucene build system to skip this check in the future.
+
+      ##################################################################
+    </fail>
+  </target>
+
+
   <target name="javacc-check">
     <fail unless="javacc.present">
       ##################################################################
@@ -218,6 +268,7 @@
   <macrodef name="compile">
     <attribute name="srcdir"/>
     <attribute name="destdir"/>
+    <attribute name="failonerror" default="true"/>
     <element name="nested" implicit="yes" optional="yes"/>
 
     <sequential>
@@ -226,8 +277,10 @@
         encoding="${build.encoding}"
         srcdir="@{srcdir}"
         destdir="@{destdir}"
+        bootclasspath="${javac.bootclasspath}"
         deprecation="${javac.deprecation}"
         debug="${javac.debug}"
+        failonerror="@{failonerror}"
         source="${javac.source}"
         target="${javac.target}">
         <nested/>
Index: src/bad-bootclasspath-test/BadBootclasspathTest.java
===================================================================
--- src/bad-bootclasspath-test/BadBootclasspathTest.java	(revision 0)
+++ src/bad-bootclasspath-test/BadBootclasspathTest.java	(revision 0)
@@ -0,0 +1,35 @@
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+/**
+ * This class exists purely to provide a compile time test of the 
+ * <code>bootclassloader</code> in use by the compiler.
+ *
+ * <p>
+ * If this class compiles cleanly, then the bootclasspath of compiler 
+ * currently in use is "too new" for creating public Lucene bouilds.
+ * </p>
+ */
+public final class BadBootclasspathTest {
+
+  private BadBootclasspathTest() {} // can't construct
+
+  /** value initialized by a method only existing in Java 1.5 */
+  private static long THREAD_ID = Thread.currentThread().getId();
+}
