Compiler error when including Google Maps extern

39 views
Skip to first unread message

jimbo

unread,
Aug 23, 2010, 7:17:42 AM8/23/10
to Closure Compiler Discuss
I've written a simple javascript file to test compilation of js with
Google Maps API. The compiler is emitting an exception when compiling
with ADVANCED_OPTIMIZATIONS.

The exception is shown below.

java.lang.RuntimeException: java.lang.RuntimeException: INTERNAL
COMPILER ERROR.
Please report this problem.
null
Node(STRING UNKNOWN_ERROR): ../closure-compiler/contrib/externs/
google_maps_api_v3.js:506:2
UNKNOWN_ERROR: 5,
Parent(OBJECTLIT): ../closure-compiler/contrib/externs/
google_maps_api_v3.js:500:29
google.maps.GeocoderStatus = {

at com.google.javascript.jscomp.Compiler.runInCompilerThread(Unknown
Source)
at com.google.javascript.jscomp.Compiler.compile(Unknown Source)
at com.google.javascript.jscomp.Compiler.compile(Unknown Source)
at com.google.javascript.jscomp.Compiler.compile(Unknown Source)
at
com.google.javascript.jscomp.AbstractCommandLineRunner.doRun(Unknown
Source)
at com.google.javascript.jscomp.AbstractCommandLineRunner.run(Unknown
Source)
at com.google.javascript.jscomp.CommandLineRunner.main(Unknown
Source)

This is the command I use for compiling.

Compiling with the following command: java -jar ../closure-compiler/
build/compiler.jar --js ../closure-library/closure/goog/base.js --js
hello.js --compilation_level=ADVANCED_OPTIMIZATIONS --externs=../
closure-compiler/contrib/externs/google_maps_api_v3.js --
formatting=PRETTY_PRINT

This is the source file hello.js

goog.provide('example');

example.showMap = function() {
var newyork = new google.maps.LatLng(40.69847032728747,
-73.9514422416687);

var myOptions = {
zoom: 6,
mapTypeId: google.maps.MapTypeId.ROADMAP
};

var map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);
map.setCenter(newyork);
};

goog.exportSymbol('example.showMap', example.showMap);

I'm using version 374 of the compilation source. Has anyone else faced
similar issue with the gmaps extern? Am I doing something obviously
wrong here? It works un-compiled and with simple compiliation.

Thanks,
James

Chad Killingsworth

unread,
Aug 23, 2010, 9:41:58 AM8/23/10
to Closure Compiler Discuss
The Google Maps v3 externs are auto-generated by the maps team and
there is now one for each major version. I'm not sure why there is one
in the contrib/externs folder still as the correct ones now live in /
contrib/externs/maps/. Can you try using the one from that folder and
see if you still have the problem?

And maybe one of the Closure team members can remove the old one that
I manually maintained in the contrib/externs folder?

Chad Killingsworth

Nick Santos

unread,
Aug 23, 2010, 10:21:42 AM8/23/10
to closure-comp...@googlegroups.com
Thanks for reporting. There's already a fix in progress for the issue.
It should land on svn today.

Nick

Nick Santos

unread,
Aug 23, 2010, 5:50:46 PM8/23/10
to closure-comp...@googlegroups.com
fwiw, this should be fixed at trunk.

jimbo

unread,
Aug 23, 2010, 10:01:58 PM8/23/10
to Closure Compiler Discuss
Great. It works now thanks.

I did have to change to use the externs file from maps folder. The one
in contrib is missing MapTypeId.

< f = {zoom:6, mapTypeId:google.maps.MapTypeId.ROADMAP};
---
> f = {zoom:6, a:google.maps.MapTypeId.ROADMAP};


On Aug 23, 5:50 pm, Nick Santos <nicksan...@google.com> wrote:
> fwiw, this should be fixed at trunk.
>
>
>
> On Mon, Aug 23, 2010 at 10:21 AM, Nick Santos <nicksan...@google.com> wrote:
> > Thanks for reporting. There's already a fix in progress for the issue.
> > It should land on svn today.
>
> > Nick
>
Reply all
Reply to author
Forward
0 new messages