Add experimental flag to support OpenJDK builds.

bug: 8992787

(cherry picked from commit d1dbe7f5a23bacdff086b4992e1d31a96da706c3)

Change-Id: Ie977d4f26ae8d3eee9d7b9cf2c0c270bee5b54b3
diff --git a/core/combo/javac.mk b/core/combo/javac.mk
index f8c99fb..74490fd 100644
--- a/core/combo/javac.mk
+++ b/core/combo/javac.mk
@@ -6,13 +6,21 @@
 #
 # Outputs:
 #   COMMON_JAVAC -- Java compiler command with common arguments
+#
+
+ifeq ($(EXPERIMENTAL_USE_JAVA7_OPENJDK),)
+common_flags := -target 1.5 -Xmaxerrs 9999999
+else
+common_flags := -Xmaxerrs 9999999
+endif
+
 
 # Whatever compiler is on this system.
 ifeq ($(BUILD_OS), windows)
     COMMON_JAVAC := development/host/windows/prebuilt/javawrap.exe -J-Xmx256m \
-        -target 1.5 -Xmaxerrs 9999999
+        $(common_flags)
 else
-    COMMON_JAVAC := javac -J-Xmx512M -target 1.5 -Xmaxerrs 9999999
+    COMMON_JAVAC := javac -J-Xmx512M $(common_flags)
 endif
 
 # Eclipse.
@@ -22,14 +30,6 @@
     $(info CUSTOM_JAVA_COMPILER=eclipse)
 endif
 
-# OpenJDK.
-ifeq ($(CUSTOM_JAVA_COMPILER), openjdk)
-    # We set the VM options (like -Xmx) in the javac script.
-    COMMON_JAVAC := prebuilt/common/openjdk/bin/javac -target 1.5 \
-        -Xmaxerrs 9999999
-    $(info CUSTOM_JAVA_COMPILER=openjdk)
-endif
-   
 HOST_JAVAC ?= $(COMMON_JAVAC)
 TARGET_JAVAC ?= $(COMMON_JAVAC)