openjdk-7 support

181 views
Skip to first unread message

Hochhaus, Andrew

unread,
May 2, 2013, 11:04:38 AM5/2/13
to closure-temp...@googlegroups.com
Hello,

I am trying to compile closure-templates with openjdk-7 on Debian Wheezy. When I run "ant SoyToJsSrcCompiler" I get an error [1].

However, by modifying build.xml to not depend explicitly on 1.6 everything builds successfully:

ahochhaus@ahochhaus-pc:/tmp/closure-templates-read-only$ svn diff
Index: build.xml
===================================================================
--- build.xml   (revision 28)
+++ build.xml   (working copy)
@@ -75,8 +75,6 @@
     <!-- Java compilation. -->
     <javac srcdir="${java.src.dir}:${build.genfiles.dir}"
            destdir="${build.classes.dir}"
-           source="1.6"
-           target="1.6"
            includeAntRuntime="true"
            debug="${includeDebugInfo}">
       <classpath refid="classpath.path" />

Any reason these assumptions of 1.6 cannot be removed? If they can be removed would any Googler be willing to land this upstream (or would you prefer the standard issue/code review process)?

Thanks,
-Andy

[1] ahochhaus@ahochhaus-pc:/tmp/closure-templates-read-only$ ant SoyToJsSrcCompiler
Buildfile: /tmp/closure-templates-read-only/build.xml

compile:
    [mkdir] Created dir: /tmp/closure-templates-read-only/build/classes
    [mkdir] Created dir: /tmp/closure-templates-read-only/build/genfiles
    [mkdir] Created dir: /tmp/closure-templates-read-only/build/genfiles/com/google/template/soy/exprparse
    [mkdir] Created dir: /tmp/closure-templates-read-only/build/genfiles/com/google/template/soy/soyparse
   [javacc] Java Compiler Compiler Version 5.0 (Parser Generator)
   [javacc] (type "javacc" with no arguments for help)
   [javacc] Reading from file /tmp/closure-templates-read-only/java/src/com/google/template/soy/exprparse/ExpressionParser.jj . . .
   [javacc] Note: UNICODE_INPUT option is specified. Please make sure you create the parser/lexer using a Reader with the correct character encoding.
   [javacc] File "TokenMgrError.java" does not exist.  Will create one.
   [javacc] File "ParseException.java" does not exist.  Will create one.
   [javacc] File "Token.java" does not exist.  Will create one.
   [javacc] File "SimpleCharStream.java" does not exist.  Will create one.
   [javacc] Parser generated successfully.
   [javacc] Java Compiler Compiler Version 5.0 (Parser Generator)
   [javacc] (type "javacc" with no arguments for help)
   [javacc] Reading from file /tmp/closure-templates-read-only/java/src/com/google/template/soy/soyparse/SoyFileParser.jj . . .
   [javacc] Note: UNICODE_INPUT option is specified. Please make sure you create the parser/lexer using a Reader with the correct character encoding.
   [javacc] File "TokenMgrError.java" does not exist.  Will create one.
   [javacc] File "ParseException.java" does not exist.  Will create one.
   [javacc] File "Token.java" does not exist.  Will create one.
   [javacc] File "SimpleCharStream.java" does not exist.  Will create one.
   [javacc] Parser generated successfully.
   [javacc] Java Compiler Compiler Version 5.0 (Parser Generator)
   [javacc] (type "javacc" with no arguments for help)
   [javacc] Reading from file /tmp/closure-templates-read-only/java/src/com/google/template/soy/soyparse/TemplateParser.jj . . .
   [javacc] Note: UNICODE_INPUT option is specified. Please make sure you create the parser/lexer using a Reader with the correct character encoding.
   [javacc] Warning: Line 646, Column 3: Regular expression for XXX_NO_CMD_NAME can be matched by the empty string ("") in lexical state AFTER_SOY_TAG_OPEN. This can result in an endless loop of empty string matches.
   [javacc] Warning: Line 704, Column 3: Regular expression for NOT_CMD_NAME_BOUNDARY_AFTER_CMD_NAME can be matched by the empty string ("") in lexical state AFTER_CMD_NAME_1. This can result in an endless loop of empty string matches.
   [javacc] Warning: Line 704, Column 3: Regular expression for NOT_CMD_NAME_BOUNDARY_AFTER_CMD_NAME can be matched by the empty string ("") in lexical state AFTER_CMD_NAME_2. This can result in an endless loop of empty string matches.
   [javacc] File "TokenMgrError.java" is being rebuilt.
   [javacc] File "ParseException.java" is being rebuilt.
   [javacc] File "Token.java" is being rebuilt.
   [javacc] File "SimpleCharStream.java" is being rebuilt.
   [javacc] Parser generated with 0 errors and 3 warnings.
    [javac] Compiling 375 source files to /tmp/closure-templates-read-only/build/classes
    [javac] warning: [options] bootstrap class path not set in conjunction with -source 1.6
    [javac] error: warnings found and -Werror specified
    [javac] 1 error
    [javac] 1 warning

BUILD FAILED
/tmp/closure-templates-read-only/build.xml:81: Compile failed; see the compiler error output for details.

Total time: 3 seconds

Mike Samuel

unread,
May 2, 2013, 6:18:09 PM5/2/13
to closure-temp...@googlegroups.com
Maybe removing -source while leaving -target would be a less
controversial change. Does just removing the -source fix your
problem?

Removing the -source so that the current JDK's javac handle the source
encoding seems fine since it doesn't look like Java 7 or 8 are going
to repeat the "assert" keyword problem, but if you leave the -target,
then others will be able to use the jars even when using an older JVM.


2013/5/2 Hochhaus, Andrew <ahoc...@samegoal.com>:
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "Closure Templates Discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to closure-templates-...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Hochhaus, Andrew

unread,
May 2, 2013, 7:26:15 PM5/2/13
to closure-temp...@googlegroups.com
Thanks Mike.

On Thu, May 2, 2013 at 6:18 PM, Mike Samuel <mikes...@gmail.com> wrote:
> Maybe removing -source while leaving -target would be a less
> controversial change. Does just removing the -source fix your
> problem?

Unfortunately not. With just -source removed, I get:

[javac] Compiling 375 source files to
/tmp/closure-templates-read-only/build/classes
[javac]
[javac] WARNING
[javac]
[javac] The -source switch defaults to 1.7 in JDK 1.7.
[javac] If you specify -target 1.6 you now must also specify -source 1.6.
[javac] Ant will implicitly add -source 1.6 for you. Please
change your build file.
[javac] warning: [options] bootstrap class path not set in
conjunction with -source 1.6
[javac] error: warnings found and -Werror specified
[javac] 1 error
[javac] 1 warning

Any other ideas?

-Andy

Hochhaus, Andrew

unread,
May 21, 2013, 11:23:44 AM5/21/13
to closure-temp...@googlegroups.com
On Mon, May 20, 2013 at 11:07 PM, Leo Luo <smar...@gmail.com> wrote:
> Have you fixed your problem yet?

The only solution I know of (for openjdk-7) is to modify build.xml
removing the explicit deps on 1.6 (see first email in this thread for
a diff). However that change can't be merged as it might cause
problems for old JVM users.

I'm not sure of a real solution to the problem.

-Andy
Reply all
Reply to author
Forward
0 new messages