Skip to content

Instantly share code, notes, and snippets.

@also
Created November 30, 2013 18:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save also/7722928 to your computer and use it in GitHub Desktop.
Save also/7722928 to your computer and use it in GitHub Desktop.
closure-compiler java 6 support
From cf03c8a20ef3f2d90f8218ec503e2bbd302bb2b8 Mon Sep 17 00:00:00 2001
From: Ryan Berdeen <ryan@ryanberdeen.com>
Date: Sat, 30 Nov 2013 13:46:27 -0500
Subject: [PATCH] java 6 support
---
build.xml | 8 ++++----
.../google/javascript/jscomp/ProcessClosurePrimitives.java | 11 +++++++++--
2 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/build.xml b/build.xml
index 4969369..7bb1858 100644
--- a/build.xml
+++ b/build.xml
@@ -30,9 +30,9 @@
-->
<property name="test.fork" value="true"/>
- <!-- Force java 7 -->
- <property name="ant.build.javac.source" value="1.7" />
- <property name="ant.build.javac.target" value="1.7" />
+ <!-- Force java 6 -->
+ <property name="ant.build.javac.source" value="1.6" />
+ <property name="ant.build.javac.target" value="1.6" />
<!-- define other variables -->
<property name="javac.debug" value="on" />
@@ -434,7 +434,7 @@
<pathelement location="${gen.dir}" />
</sourcepath>
<classpath refid="allclasspath.path" />
- <link href="http://docs.oracle.com/javase/7/docs/api/" />
+ <link href="http://java.sun.com/javase/6/docs/api/" />
</javadoc>
</target>
diff --git a/src/com/google/javascript/jscomp/ProcessClosurePrimitives.java b/src/com/google/javascript/jscomp/ProcessClosurePrimitives.java
index 12f87d7..08b2b1c 100644
--- a/src/com/google/javascript/jscomp/ProcessClosurePrimitives.java
+++ b/src/com/google/javascript/jscomp/ProcessClosurePrimitives.java
@@ -788,11 +788,18 @@ class ProcessClosurePrimitives extends AbstractPostOrderCallback
CodingConvention convention = compiler.getCodingConvention();
String typeDeclaration = null;
+ boolean invalidForwardDeclare = false;
try {
typeDeclaration = Iterables.getOnlyElement(
convention.identifyTypeDeclarationCall(n));
- } catch (NullPointerException | NoSuchElementException |
- IllegalArgumentException e) {
+ } catch (NullPointerException e) {
+ invalidForwardDeclare = true;
+ } catch (NoSuchElementException e) {
+ invalidForwardDeclare = true;
+ } catch (IllegalArgumentException e) {
+ invalidForwardDeclare = true;
+ }
+ if (invalidForwardDeclare) {
compiler.report(
t.makeError(n, INVALID_FORWARD_DECLARE,
"A single type could not identified for the goog.forwardDeclare " +
--
1.8.3.4 (Apple Git-47)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment