[gwt-contrib] Re: Allow RPC for unmodificable collections (issue620805)

2010-07-08 Thread rice


http://gwt-code-reviews.appspot.com/620805/diff/1/2
File
user/src/com/google/gwt/user/client/rpc/core/java/util/Collections.java
(right):

http://gwt-code-reviews.appspot.com/620805/diff/1/2#newcode135
user/src/com/google/gwt/user/client/rpc/core/java/util/Collections.java:135:
/**
In practice it works fine with Sun's JDK and I expect it would work with
a Harmony-based classlib as well -- they and GWT are all using
compatible type definitions for singleton and unmodifiable collections.

I would be somewhat surprised if GWT RPC actually worked with a truly
"exotic" JDK that was neither Sun nor Apache based -- and I don't think
we should avoid implementing a useful feature just because it might
break on some future JDK.  Right now users can't RPC these types of
collections at all, so if they have to use an incompatible JDK the worst
case is that they will try to use this feature, fail, file a bug, and we
will add a case to support them in the server-side code.

This feature by itself isn't worth a major revamping of RPC semantics
IMHO.

On 2010/07/07 20:37:27, jat wrote:

So how does this work with server-side implementation classes?  Aren't

they

going to need custom serializers for whatever internal classes the

particular

JVM uses?



Previously we said the solution was RPC-by-interface, which would

allow you to

say that the default implementation for any unknown List subtype is

ArrayList,

for example, though obviously that breaks a List view onto some larger

data

structure.



http://gwt-code-reviews.appspot.com/620805/diff/1/4
File user/super/com/google/gwt/emul/java/util/Collections.java (right):

http://gwt-code-reviews.appspot.com/620805/diff/1/4#newcode141
user/super/com/google/gwt/emul/java/util/Collections.java:141: private
static final class SingletonMap extends AbstractMap
implements Serializable {
O.K.

On 2010/07/07 20:37:27, jat wrote:

Javadoc explaining when this is used.


http://gwt-code-reviews.appspot.com/620805/diff/1/6
File user/test/com/google/gwt/user/client/rpc/CollectionsTest.java
(right):

http://gwt-code-reviews.appspot.com/620805/diff/1/6#newcode590
user/test/com/google/gwt/user/client/rpc/CollectionsTest.java:590:
service.echoSingletonMap(TestSetFactory.createSingletonMap(),
I'll add createXXX methods to the test service.

On 2010/07/07 20:37:27, jat wrote:

Shouldn't these have a method where the various internal collection

types are

created on the server?


http://gwt-code-reviews.appspot.com/620805/diff/1/11
File
user/test/com/google/gwt/user/server/rpc/CollectionsTestServiceImpl.java
(right):

http://gwt-code-reviews.appspot.com/620805/diff/1/11#newcode450
user/test/com/google/gwt/user/server/rpc/CollectionsTestServiceImpl.java:450:
return value;
O.K.

On 2010/07/07 20:37:27, jat wrote:

Instead of returning the same value, what about creating a new one on

the server

from the one supplied, so we can test freshly-created instances?


http://gwt-code-reviews.appspot.com/620805/show

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors


[gwt-contrib] Re: Allow RPC for unmodificable collections (issue620805)

2010-07-08 Thread rice

http://gwt-code-reviews.appspot.com/620805/show

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors


[gwt-contrib] Re: Reorder outer 'this' constructor arguments to come before user arguments. (issue675801)

2010-07-08 Thread tobyr

LGTM, with some nits.


http://gwt-code-reviews.appspot.com/675801/diff/1/3
File dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaAST.java
(right):

http://gwt-code-reviews.appspot.com/675801/diff/1/3#newcode701
dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaAST.java:701:
paramIt = getSyntheticLocalsIterator();
Prefer declaring a new var here. syntheticParamIt?

http://gwt-code-reviews.appspot.com/675801/diff/1/3#newcode1258
dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaAST.java:1258: //
Synthetic locals for local classes
Move this comment up to replace the one right above it?

http://gwt-code-reviews.appspot.com/675801/diff/1/3#newcode1952
dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaAST.java:1952: for
(SyntheticArgumentBinding unused : nestedBinding.outerLocalVariables) {
This formulation of the for loop seems akward to me. I prefer the older
version of this where it's more obvious that i is just a counting
variable. As evidence of akwardness, Intellij warns that unused is
actually unused in contrast to i.

Of course, it'd be even better if we had a doTimes loop variant.

http://gwt-code-reviews.appspot.com/675801/diff/1/3#newcode2323
dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaAST.java:2323:
private ListIterator getSyntheticLocalsIterator() {
You ever only assign this to an Iterator. Why choose a ListIterator?

http://gwt-code-reviews.appspot.com/675801/show

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors


[gwt-contrib] Re: JSNI ::new() now targets constructors directly (issue676801)

2010-07-08 Thread tobyr

LGTM


http://gwt-code-reviews.appspot.com/676801/diff/1/4
File dev/core/src/com/google/gwt/dev/jjs/impl/ControlFlowAnalyzer.java
(right):

http://gwt-code-reviews.appspot.com/676801/diff/1/4#newcode424
dev/core/src/com/google/gwt/dev/jjs/impl/ControlFlowAnalyzer.java:424:
// JsniMethodRef rescues as JMethodCall or JNewInstance
s/as/a

http://gwt-code-reviews.appspot.com/676801/diff/1/4#newcode427
dev/core/src/com/google/gwt/dev/jjs/impl/ControlFlowAnalyzer.java:427:
rescue(x.getTarget().getEnclosingType(), true, true);
What do you think about refactoring this and visit(JNewInstance) to
delegate to the same method - maybe rescueType or
rescueTypeOnInstantiation? I know it's only a single line of code and a
comment, but it would make me feel better from a maintenance standpoint
- encouraging the two not to diverge.

http://gwt-code-reviews.appspot.com/676801/diff/1/6
File dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaScriptAST.java
(right):

http://gwt-code-reviews.appspot.com/676801/diff/1/6#newcode1343
dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaScriptAST.java:1343:
if (ident.charAt(0) == '@') {
Realize you didn't introduce this, but replace magic char comparison
with a function? Ditto below.

http://gwt-code-reviews.appspot.com/676801/diff/1/6#newcode1379
dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaScriptAST.java:1379:
// Replace with a tear-off function.
I'm not familiar with the term, "tear-off function". Is there something
special going on here that's being denoted beyond a normal closure
creation?

http://gwt-code-reviews.appspot.com/676801/diff/1/7
File dev/core/src/com/google/gwt/dev/jjs/impl/JsniRefLookup.java
(right):

http://gwt-code-reviews.appspot.com/676801/diff/1/7#newcode207
dev/core/src/com/google/gwt/dev/jjs/impl/JsniRefLookup.java:207: if
(method instanceof JConstructor && "new".equals(memberName)) {
JsniRef.NEW (and below)?

http://gwt-code-reviews.appspot.com/676801/show

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors


[gwt-contrib] Fixes a bug where temp local declarations can sometimes end up in a for statement's increments list. (issue677801)

2010-07-08 Thread scottb

Reviewers: bowdidge, Lex,


http://gwt-code-reviews.appspot.com/677801/diff/1/2
File dev/core/src/com/google/gwt/dev/jjs/ast/Context.java (right):

http://gwt-code-reviews.appspot.com/677801/diff/1/2#newcode33
dev/core/src/com/google/gwt/dev/jjs/ast/Context.java:33: boolean
isLvalue();
All the changes related to implementing isLvalue() follow the same
pattern used in the JS AST.  See JsContext.  Implementation is basically
identical, too.

Hopefully, this can be useful for simplifying some optimization visitors
as well.

http://gwt-code-reviews.appspot.com/677801/diff/1/9
File dev/core/test/com/google/gwt/dev/jjs/impl/TempLocalVisitorTest.java
(right):

http://gwt-code-reviews.appspot.com/677801/diff/1/9#newcode36
dev/core/test/com/google/gwt/dev/jjs/impl/TempLocalVisitorTest.java:36:
private static final class AlwaysReplacer extends TempLocalVisitor {
These are two unrelated changes.

1) Reimplement the existing logic using Context.isLvalue() because it's
much simpler and more fool proof than calling out all the cases.  I was
running into an error would I would try to replace a binary assignment
twice... once during visit and once during endVisit, which isn't
allowed.

2) Added the 'dontBother' part to prevent stupid replacements like
replacing an entire assignment statement with a temp that represents the
result of the assignment.

http://gwt-code-reviews.appspot.com/677801/diff/1/9#newcode98
dev/core/test/com/google/gwt/dev/jjs/impl/TempLocalVisitorTest.java:98:
expected.append("for (int $t0 = 0, i = $t0; $t1; i += $t2);");
This test fails without the change to TempLocalVisitor, because the 'int
$t2 = 1' becomes the first statement of the increments clause.

Description:
Also adds Context.isLvalue() to the Java AST, mirroring the JsContext
from the JS AST.

Please review this at http://gwt-code-reviews.appspot.com/677801/show

Affected files:
  M dev/core/src/com/google/gwt/dev/jjs/ast/Context.java
  M dev/core/src/com/google/gwt/dev/jjs/ast/JBinaryOperation.java
  M dev/core/src/com/google/gwt/dev/jjs/ast/JDeclarationStatement.java
  M dev/core/src/com/google/gwt/dev/jjs/ast/JModVisitor.java
  M dev/core/src/com/google/gwt/dev/jjs/ast/JUnaryOperation.java
  M dev/core/src/com/google/gwt/dev/jjs/ast/JVisitor.java
  M dev/core/src/com/google/gwt/dev/jjs/impl/TempLocalVisitor.java
  M dev/core/test/com/google/gwt/dev/jjs/impl/TempLocalVisitorTest.java


--
http://groups.google.com/group/Google-Web-Toolkit-Contributors


[gwt-contrib] Re: Fixes a bug where temp local declarations can sometimes end up in a for statement's increments list. (issue677801)

2010-07-08 Thread bowdidge


http://gwt-code-reviews.appspot.com/677801/diff/1/9
File dev/core/test/com/google/gwt/dev/jjs/impl/TempLocalVisitorTest.java
(right):

http://gwt-code-reviews.appspot.com/677801/diff/1/9#newcode87
dev/core/test/com/google/gwt/dev/jjs/impl/TempLocalVisitorTest.java:87:
public void testForStatement() throws Exception {
Should you add a test with a loop over longs because of all the extra
manipulation that goes on there?

Think it's likely that anyone's going to try to increment a long in the
test clause of a for statement?

http://gwt-code-reviews.appspot.com/677801/show

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors


[gwt-contrib] Re: Reorder outer 'this' constructor arguments to come before user arguments. (issue675801)

2010-07-08 Thread scottb


http://gwt-code-reviews.appspot.com/675801/diff/1/3
File dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaAST.java
(right):

http://gwt-code-reviews.appspot.com/675801/diff/1/3#newcode701
dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaAST.java:701:
paramIt = getSyntheticLocalsIterator();
Meh, I went for less delta.

http://gwt-code-reviews.appspot.com/675801/diff/1/3#newcode1258
dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaAST.java:1258: //
Synthetic locals for local classes
On 2010/07/08 15:30:48, tobyr wrote:

Move this comment up to replace the one right above it?


Done.

http://gwt-code-reviews.appspot.com/675801/diff/1/3#newcode1952
dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaAST.java:1952: for
(SyntheticArgumentBinding unused : nestedBinding.outerLocalVariables) {
On 2010/07/08 15:30:48, tobyr wrote:

This formulation of the for loop seems akward to me. I prefer the

older version

of this where it's more obvious that i is just a counting variable. As

evidence

of akwardness, Intellij warns that unused is actually unused in

contrast to i.


Of course, it'd be even better if we had a doTimes loop variant.


Done.

http://gwt-code-reviews.appspot.com/675801/diff/1/3#newcode2323
dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaAST.java:2323:
private ListIterator getSyntheticLocalsIterator() {
Oversight, fixed.

http://gwt-code-reviews.appspot.com/675801/show

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors


[gwt-contrib] Re: JSNI ::new() now targets constructors directly (issue676801)

2010-07-08 Thread scottb


http://gwt-code-reviews.appspot.com/676801/diff/1/4
File dev/core/src/com/google/gwt/dev/jjs/impl/ControlFlowAnalyzer.java
(right):

http://gwt-code-reviews.appspot.com/676801/diff/1/4#newcode424
dev/core/src/com/google/gwt/dev/jjs/impl/ControlFlowAnalyzer.java:424:
// JsniMethodRef rescues as JMethodCall or JNewInstance
On 2010/07/08 16:25:58, tobyr wrote:

s/as/a


I actually did mean 'as', but I could probably make the comment a little
clearer.

http://gwt-code-reviews.appspot.com/676801/diff/1/4#newcode427
dev/core/src/com/google/gwt/dev/jjs/impl/ControlFlowAnalyzer.java:427:
rescue(x.getTarget().getEnclosingType(), true, true);
Sure, I can add a "rescueAndInstantiate".

http://gwt-code-reviews.appspot.com/676801/diff/1/6
File dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaScriptAST.java
(right):

http://gwt-code-reviews.appspot.com/676801/diff/1/6#newcode1343
dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaScriptAST.java:1343:
if (ident.charAt(0) == '@') {
On 2010/07/08 16:25:58, tobyr wrote:

Realize you didn't introduce this, but replace magic char comparison

with a

function? Ditto below.


Done.

http://gwt-code-reviews.appspot.com/676801/diff/1/6#newcode1379
dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaScriptAST.java:1379:
// Replace with a tear-off function.
Changed to 'closureFunc'.

http://gwt-code-reviews.appspot.com/676801/diff/1/7
File dev/core/src/com/google/gwt/dev/jjs/impl/JsniRefLookup.java
(right):

http://gwt-code-reviews.appspot.com/676801/diff/1/7#newcode207
dev/core/src/com/google/gwt/dev/jjs/impl/JsniRefLookup.java:207: if
(method instanceof JConstructor && "new".equals(memberName)) {
On 2010/07/08 16:25:58, tobyr wrote:

JsniRef.NEW (and below)?


Done.

http://gwt-code-reviews.appspot.com/676801/show

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors


[gwt-contrib] Re: Fixes a bug where temp local declarations can sometimes end up in a for statement's increments list. (issue677801)

2010-07-08 Thread scottb


http://gwt-code-reviews.appspot.com/677801/diff/1/9
File dev/core/test/com/google/gwt/dev/jjs/impl/TempLocalVisitorTest.java
(right):

http://gwt-code-reviews.appspot.com/677801/diff/1/9#newcode87
dev/core/test/com/google/gwt/dev/jjs/impl/TempLocalVisitorTest.java:87:
public void testForStatement() throws Exception {
This simple unit test doesn't run the whole compiler, including any of
the long craziness, it's just a direct test of TempLocalVisitor.  The
thing is, simply compiling a for loop with a long incrementor does not
trigger the bug, because we never actually try to pull any items out of
the List as such; those increments statements only
ever get accessed via JVisitor, which never does a cast check.

http://gwt-code-reviews.appspot.com/677801/show

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors


[gwt-contrib] Re: Fixes a bug where temp local declarations can sometimes end up in a for statement's increments list. (issue677801)

2010-07-08 Thread bowdidge

LGTM.


http://gwt-code-reviews.appspot.com/677801/diff/1/9
File dev/core/test/com/google/gwt/dev/jjs/impl/TempLocalVisitorTest.java
(right):

http://gwt-code-reviews.appspot.com/677801/diff/1/9#newcode87
dev/core/test/com/google/gwt/dev/jjs/impl/TempLocalVisitorTest.java:87:
public void testForStatement() throws Exception {
Sounds ok.

http://gwt-code-reviews.appspot.com/677801/show

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors


[gwt-contrib] Re: Fixes a bug where temp local declarations can sometimes end up in a for statement's increments list. (issue677801)

2010-07-08 Thread spoon

Good find. Just one nit.


http://gwt-code-reviews.appspot.com/677801/diff/1/2
File dev/core/src/com/google/gwt/dev/jjs/ast/Context.java (right):

http://gwt-code-reviews.appspot.com/677801/diff/1/2#newcode33
dev/core/src/com/google/gwt/dev/jjs/ast/Context.java:33: boolean
isLvalue();
Cool, that should simplify many visitors.

http://gwt-code-reviews.appspot.com/677801/diff/1/9
File dev/core/test/com/google/gwt/dev/jjs/impl/TempLocalVisitorTest.java
(right):

http://gwt-code-reviews.appspot.com/677801/diff/1/9#newcode54
dev/core/test/com/google/gwt/dev/jjs/impl/TempLocalVisitorTest.java:54:
local.getDeclarationStatement().initializer = x;
It's a legacy problem in this test case, but the above replacement is
actually not sound. Instead of overwriting the declaration statement's
initializer, it would be better to replace x by (t=x,t).  Or even just
(t=x).

See below for an example.

http://gwt-code-reviews.appspot.com/677801/diff/1/9#newcode98
dev/core/test/com/google/gwt/dev/jjs/impl/TempLocalVisitorTest.java:98:
expected.append("for (int $t0 = 0, i = $t0; $t1; i += $t2);");
Imagine that instead of "i += 1" it was "i += foo()".  In that case,
it's vital to reevaluate the foo() each time through the loop.

http://gwt-code-reviews.appspot.com/677801/show

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors


[gwt-contrib] [google-web-toolkit] r8359 committed - Did 'svn merge -r8311:8310 .'...

2010-07-08 Thread codesite-noreply

Revision: 8359
Author: amitman...@google.com
Date: Thu Jul  8 11:49:11 2010
Log: Did 'svn merge -r8311:8310 .'
and updated branch-info.txt

Patch by: amitmanjhi
Review by: mmendez


http://code.google.com/p/google-web-toolkit/source/detail?r=8359

Added:
  
/branches/2.1M2/dev/core/src/com/google/gwt/dev/shell/jetty/JettyNullLogger.java

Deleted:
 /branches/2.1M2/user/test/com/google/gwt/user/BadServlets.gwt.xml
 /branches/2.1M2/user/test/com/google/gwt/user/ServletsSuite.java
 /branches/2.1M2/user/test/com/google/gwt/user/client/BadServletsTest.java
 /branches/2.1M2/user/test/com/google/gwt/user/server/BadServlets.java
Modified:
 /branches/2.1M2/branch-info.txt
 /branches/2.1M2/dev/build.xml
  
/branches/2.1M2/dev/core/src/com/google/gwt/dev/shell/jetty/JettyLauncher.java

 /branches/2.1M2/eclipse/dev/.classpath
 /branches/2.1M2/eclipse/user/.classpath
  
/branches/2.1M2/user/src/com/google/gwt/i18n/client/impl/CurrencyDataImpl.java

 /branches/2.1M2/user/src/com/google/gwt/junit/JUnitShell.java
 /branches/2.1M2/user/test/com/google/gwt/i18n/client/CurrencyTest.java

===
--- /dev/null
+++  
/branches/2.1M2/dev/core/src/com/google/gwt/dev/shell/jetty/JettyNullLogger.java	 
Thu Jul  8 11:49:11 2010

@@ -0,0 +1,50 @@
+/*
+ * Copyright 2009 Google Inc.
+ *
+ * Licensed 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.
+ */
+package com.google.gwt.dev.shell.jetty;
+
+import org.mortbay.log.Logger;
+
+/**
+ * A Jetty {...@link Logger} that suppresses all output.
+ */
+public class JettyNullLogger implements Logger {
+
+  public void debug(String msg, Throwable th) {
+  }
+
+  public void debug(String msg, Object arg0, Object arg1) {
+  }
+
+  public Logger getLogger(String name) {
+return this;
+  }
+
+  public void info(String msg, Object arg0, Object arg1) {
+  }
+
+  public boolean isDebugEnabled() {
+return false;
+  }
+
+  public void setDebugEnabled(boolean enabled) {
+  }
+
+  public void warn(String msg, Throwable th) {
+  }
+
+  public void warn(String msg, Object arg0, Object arg1) {
+  }
+}
===
--- /branches/2.1M2/user/test/com/google/gwt/user/BadServlets.gwt.xml	Thu  
Jun 24 08:11:49 2010

+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-

-
-
-  
-
-  
-  
-  
-  
-  
-  
-  
-
===
--- /branches/2.1M2/user/test/com/google/gwt/user/ServletsSuite.java	Thu  
Jun 24 08:11:49 2010

+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright 2010 Google Inc.
- *
- * Licensed 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.
- */
-package com.google.gwt.user;
-
-import com.google.gwt.junit.tools.GWTTestSuite;
-import com.google.gwt.user.client.BadServletsTest;
-
-import junit.framework.Test;
-
-/**
- * Servlet tests not belonging elsewhere.
- */
-public class ServletsSuite {
-  public static Test suite() {
-GWTTestSuite suite = new GWTTestSuite("ServletsSuite");
-suite.addTestSuite(BadServletsTest.class);
-return suite;
-  }
-}
===
---  
/branches/2.1M2/user/test/com/google/gwt/user/client/BadServletsTest.java	 
Thu Jun 24 08:11:49 2010

+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright 2010 Google Inc.
- *
- * Licensed 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.
- */
-package com.google.gwt.user.client;
-
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.http.client.Request;
-import com.google.gwt.http.client.RequestBuilder;
-im

[gwt-contrib] Re: Fixes a bug where temp local declarations can sometimes end up in a for statement's increments list. (issue677801)

2010-07-08 Thread scottb


http://gwt-code-reviews.appspot.com/677801/diff/1/9
File dev/core/test/com/google/gwt/dev/jjs/impl/TempLocalVisitorTest.java
(right):

http://gwt-code-reviews.appspot.com/677801/diff/1/9#newcode54
dev/core/test/com/google/gwt/dev/jjs/impl/TempLocalVisitorTest.java:54:
local.getDeclarationStatement().initializer = x;
That would make a lot more intuitive sense for someone looking at what
this test does!

But... I don't want to obscure this patch by adding in that change,
because I'll have to rewrite the expected results for every test in this
file.  How about I do that change in a follow-up, and for this change
I'll add a note to AlwaysReplacer to the effect that it doesn't even try
to preserve semantics.  It literally just blows through and replaces
expressions with temps with no regard for evaluation order, so this is
the intended behavior for this test.

http://gwt-code-reviews.appspot.com/677801/show

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors


[gwt-contrib] Re: Fixes a bug where temp local declarations can sometimes end up in a for statement's increments list. (issue677801)

2010-07-08 Thread spoon

Sure, LGTM.

http://gwt-code-reviews.appspot.com/677801/show

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors


[gwt-contrib] TempLocalVisitorTest now uses non-destructive code transforms (improves clarity) (issue679801)

2010-07-08 Thread scottb

Reviewers: Lex,

Message:
Follow-up to http://gwt-code-reviews.appspot.com/677801/show

Description:
Suggested by: spoon

Please review this at http://gwt-code-reviews.appspot.com/679801/show

Affected files:
  M dev/core/test/com/google/gwt/dev/jjs/impl/TempLocalVisitorTest.java


--
http://groups.google.com/group/Google-Web-Toolkit-Contributors


[gwt-contrib] Re: Fixes a bug where temp local declarations can sometimes end up in a for statement's increments list. (issue677801)

2010-07-08 Thread scottb

See http://gwt-code-reviews.appspot.com/679801/show

http://gwt-code-reviews.appspot.com/677801/show

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors


[gwt-contrib] Re: TempLocalVisitorTest now uses non-destructive code transforms (improves clarity) (issue679801)

2010-07-08 Thread spoon

LGTM. It makes the test case a better example of how to use the
facility.


http://gwt-code-reviews.appspot.com/679801/show

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors


[gwt-contrib] [google-web-toolkit] r8360 committed - Adding NoSelectionModel, which allows selection without saving the sel...

2010-07-08 Thread codesite-noreply

Revision: 8360
Author: jlaba...@google.com
Date: Fri Jul  2 10:23:18 2010
Log: Adding NoSelectionModel, which allows selection without saving the  
selection state.


Review at http://gwt-code-reviews.appspot.com/667801

Review by: j...@google.com
http://code.google.com/p/google-web-toolkit/source/detail?r=8360

Added:
 /trunk/user/src/com/google/gwt/view/client/NoSelectionModel.java
 /trunk/user/test/com/google/gwt/view/client/NoSelectionModelTest.java
Modified:
  
/trunk/bikeshed/src/com/google/gwt/sample/expenses/gwt/client/ExpenseList.java
  
/trunk/bikeshed/src/com/google/gwt/sample/expenses/gwt/client/MobileExpenseList.java
  
/trunk/bikeshed/src/com/google/gwt/sample/expenses/gwt/client/MobileReportList.java

 /trunk/user/test/com/google/gwt/view/ViewSuite.java

===
--- /dev/null
+++ /trunk/user/src/com/google/gwt/view/client/NoSelectionModel.java	Fri  
Jul  2 10:23:18 2010

@@ -0,0 +1,60 @@
+/*
+ * Copyright 2010 Google Inc.
+ *
+ * Licensed 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.
+ */
+package com.google.gwt.view.client;
+
+import com.google.gwt.view.client.SelectionModel.AbstractSelectionModel;
+
+/**
+ * A selection model that does not allow selection, but fires selection  
change
+ * events. Use this model if you want to know when a user selects an item,  
but

+ * do not want the view to update based on the selection.
+ *
+ * 
+ * Note: This class is new and its interface subject to change.
+ * 
+ *
+ * @param  the record data type
+ */
+public class NoSelectionModel extends AbstractSelectionModel {
+
+  private Object lastKey;
+  private T lastSelection;
+
+  /**
+   * Gets the object that was last selected.
+   *
+   * @return the last selected object
+   */
+  public T getLastSelectedObject() {
+return lastSelection;
+  }
+
+  public boolean isSelected(T object) {
+return false;
+  }
+
+  public void setSelected(T object, boolean selected) {
+Object key = getKey(object);
+if (selected) {
+  lastSelection = object;
+  lastKey = key;
+} else if (lastKey != null && lastKey.equals(key)) {
+  lastSelection = null;
+  lastKey = null;
+}
+scheduleSelectionChangeEvent();
+  }
+}
===
--- /dev/null
+++ /trunk/user/test/com/google/gwt/view/client/NoSelectionModelTest.java	 
Fri Jul  2 10:23:18 2010

@@ -0,0 +1,87 @@
+/*
+ * Copyright 2010 Google Inc.
+ *
+ * Licensed 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.
+ */
+package com.google.gwt.view.client;
+
+import com.google.gwt.view.client.SelectionModel.SelectionChangeEvent;
+import com.google.gwt.view.client.SelectionModel.SelectionChangeHandler;
+
+/**
+ * Tests for {...@link NoSelectionModel}.
+ */
+public class NoSelectionModelTest extends AbstractSelectionModelTest {
+
+  public void testGetLastSelectedObject() {
+NoSelectionModel model = createSelectionModel();
+assertNull(model.getLastSelectedObject());
+
+model.setSelected("test", true);
+assertEquals("test", model.getLastSelectedObject());
+
+model.setSelected("test", false);
+assertNull(model.getLastSelectedObject());
+  }
+
+  public void testSelectedChangeEvent() {
+NoSelectionModel model = createSelectionModel();
+SelectionChangeHandler handler = new SelectionChangeHandler() {
+  public void onSelectionChange(SelectionChangeEvent event) {
+finishTest();
+  }
+};
+model.addSelectionChangeHandler(handler);
+
+delayTestFinish(2000);
+model.setSelected("test", true);
+  }
+
+  public void testSetSelected() {
+NoSelectionModel model = createSelectionModel();
+assertFalse(model.isSelected("test0"));
+
+model.setSelected("test0", true);
+assertFalse(model.isSelected("test0"));
+
+model.setSelected("test1", true);
+assertFalse(model.isSelected("test1"));
+  }
+
+  public void testSetSelectedWithKeyProvider() {
+NoSelectionModel model = createSelectionModel();
+ProvidesKey 

[gwt-contrib] [google-web-toolkit] r8361 committed - Fix for http://code.google.com/p/google-web-toolkit/issues/detail?id=4...

2010-07-08 Thread codesite-noreply

Revision: 8361
Author: t...@google.com
Date: Mon Jul  5 09:18:17 2010
Log: Fix for  
http://code.google.com/p/google-web-toolkit/issues/detail?id=4814

Fixes a bug with deRPC serialization of boolean values. When a boolean value
is read by the client, it's currently interpreted as a number. When it's
serialized again to the server, it becomes a Double object.

This change adds a test to isolate the issue, and a proposed fix. Instead of
requiring the argument to be written as 'false' to the client, it relaxes  
what

the server accepts as potential boolean values, allowing 0 or 1 as well.

Review by: robertvaw...@google.com
http://code.google.com/p/google-web-toolkit/source/detail?r=8361

Modified:
 /trunk/user/src/com/google/gwt/rpc/server/CommandSerializationUtil.java
 /trunk/user/test/com/google/gwt/user/client/rpc/InheritanceTest.java
  
/trunk/user/test/com/google/gwt/user/client/rpc/InheritanceTestSetFactory.java


===
--- /trunk/user/src/com/google/gwt/rpc/server/CommandSerializationUtil.java	 
Wed Oct 28 09:10:53 2009
+++ /trunk/user/src/com/google/gwt/rpc/server/CommandSerializationUtil.java	 
Mon Jul  5 09:18:17 2010

@@ -103,8 +103,20 @@

   @Override
   public void set(Object instance, long offset, Object value) {
-theUnsafe.putBoolean(instance, offset, ((Boolean) value));
-  }
+theUnsafe.putBoolean(instance, offset, toBoolean(value));
+  }
+
+  private boolean toBoolean(Object value) {
+if (value instanceof Number) {
+  return ((Number) value).intValue() != 0;
+} else if (value instanceof String) {
+  return Boolean.valueOf((String) value);
+} else {
+  // returns false if the value is null.
+  return Boolean.TRUE.equals(value);
+}
+  }
+
 },
 BYTE {
   @Override
===
--- /trunk/user/test/com/google/gwt/user/client/rpc/InheritanceTest.java	 
Wed Nov  4 13:03:23 2009
+++ /trunk/user/test/com/google/gwt/user/client/rpc/InheritanceTest.java	 
Mon Jul  5 09:18:17 2010

@@ -93,6 +93,33 @@
   }
 });
   }
+
+  /**
+   * Tests that a serialized type can be sent again on the wire.
+   */
+  public void testResendJavaSerializableClass() {
+final InheritanceTestServiceAsync service = getServiceAsync();
+final InheritanceTestSetFactory.JavaSerializableClass first =
+new InheritanceTestSetFactory.JavaSerializableClass(3);
+AsyncCallback resendCallback = new AsyncCallback() {
+private boolean resend = true;
+public void onFailure(Throwable caught) {
+  TestSetValidator.rethrowException(caught);
+}
+
+public void onSuccess(Object result) {
+  assertEquals(first, result);
+  if (resend) {
+resend = false;
+service.echo((InheritanceTestSetFactory.JavaSerializableClass)  
result, this);

+  } else {
+finishTest();
+  }
+}
+};
+delayTestFinishForRpc();
+service.echo(first, resendCallback);
+  }

   /**
* Test that non-static inner classes are not serializable.
===
---  
/trunk/user/test/com/google/gwt/user/client/rpc/InheritanceTestSetFactory.java	 
Wed Aug 15 15:15:17 2007
+++  
/trunk/user/test/com/google/gwt/user/client/rpc/InheritanceTestSetFactory.java	 
Mon Jul  5 09:18:17 2010

@@ -72,6 +72,23 @@
 public JavaSerializableBaseClass(int field1) {
   this.field1 = field1;
 }
+
+@Override
+public int hashCode() {
+  return field1;
+}
+
+@Override
+public boolean equals(Object obj) {
+  if (obj == this) {
+return true;
+  }
+  if (obj == null || obj.getClass() != this.getClass()) {
+return false;
+  }
+  JavaSerializableBaseClass other = (JavaSerializableBaseClass) obj;
+  return field1 == other.field1;
+}
   }

   /**
@@ -79,6 +96,7 @@
*/
   public static class JavaSerializableClass extends  
JavaSerializableBaseClass {

 private int field2 = -2;
+private boolean field3 = true;

 public JavaSerializableClass() {
 }
@@ -86,6 +104,23 @@
 public JavaSerializableClass(int field2) {
   this.field2 = field2;
 }
+
+@Override
+public int hashCode() {
+  return super.hashCode() << 19 + field2;
+}
+
+@Override
+public boolean equals(Object obj) {
+  if (obj == this) {
+return true;
+  }
+  if (obj == null || obj.getClass() != this.getClass()) {
+return false;
+  }
+  JavaSerializableClass other = (JavaSerializableClass) obj;
+  return super.equals(other) && field2 == other.field2 && field3 ==  
other.field3;

+}
   }

   /**

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors


[gwt-contrib] [google-web-toolkit] r8362 committed - Fix external issue 4711 - java.sql.Timestamp#compareTo(java.util.Date)...

2010-07-08 Thread codesite-noreply

Revision: 8362
Author: r...@google.com
Date: Wed Jul  7 04:47:08 2010
Log: Fix external issue 4711 - java.sql.Timestamp#compareTo(java.util.Date)  
silently crashes in Firefox and Chrome


Review at http://gwt-code-reviews.appspot.com/634802

Review by: j...@google.com
http://code.google.com/p/google-web-toolkit/source/detail?r=8362

Modified:
 /trunk/user/super/com/google/gwt/emul/java/sql/Timestamp.java
 /trunk/user/test/com/google/gwt/emultest/java/sql/SqlTimestampTest.java

===
--- /trunk/user/super/com/google/gwt/emul/java/sql/Timestamp.java	Mon Jan   
4 19:21:08 2010
+++ /trunk/user/super/com/google/gwt/emul/java/sql/Timestamp.java	Wed Jul   
7 04:47:08 2010

@@ -108,8 +108,11 @@

   @Override
   public int compareTo(java.util.Date o) {
-// JavaDoc says a ClassCastException is correct behavior
-return compareTo((Timestamp) o);
+if (o instanceof Timestamp) {
+  return compareTo((Timestamp) o);
+} else {
+  return compareTo(new Timestamp(o.getTime()));
+}
   }

   public int compareTo(Timestamp o) {
===
--- /trunk/user/test/com/google/gwt/emultest/java/sql/SqlTimestampTest.java	 
Mon Jan  4 11:06:23 2010
+++ /trunk/user/test/com/google/gwt/emultest/java/sql/SqlTimestampTest.java	 
Wed Jul  7 04:47:08 2010

@@ -15,7 +15,6 @@
  */
 package com.google.gwt.emultest.java.sql;

-import com.google.gwt.core.client.GWT;
 import com.google.gwt.junit.client.GWTTestCase;

 import java.sql.Timestamp;
@@ -59,16 +58,9 @@
 assertEquals("d2, t", d2, t);
 assertEquals("hashcode", d2.hashCode(), t.hashCode());
 assertFalse("t.equals(d2)", t.equals(d2));
-
-if (GWT.isScript()) {
-  // It looks like not all JVMs will throw the CCE, just check web  
mode.

-  try {
-t.compareTo(d2);
-fail("Should throw ClassCastException");
-  } catch (ClassCastException e) {
-// Correct
-  }
-}
+
+// t is later then d2 by some number of nanoseconds
+assertEquals(1, t.compareTo(d2));

 Timestamp t2 = new Timestamp(d.getTime());
 t2.setNanos(t.getNanos() + 1);

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors


[gwt-contrib] [google-web-toolkit] r8368 committed - Fixes a bug where temp local declarations could sometimes end up in a ...

2010-07-08 Thread codesite-noreply

Revision: 8368
Author: gwt.mirror...@gmail.com
Date: Thu Jul  8 09:38:20 2010
Log: Fixes a bug where temp local declarations could sometimes end up in a  
for statement's increments list.


Also adds Context.isLvalue() to the Java AST, mirroring the JsContext from  
the JS AST.


http://gwt-code-reviews.appspot.com/677801/show
Review by: bowdi...@google.com, spoon

http://code.google.com/p/google-web-toolkit/source/detail?r=8368

Modified:
 /trunk/dev/core/src/com/google/gwt/dev/jjs/ast/Context.java
 /trunk/dev/core/src/com/google/gwt/dev/jjs/ast/JBinaryOperation.java
 /trunk/dev/core/src/com/google/gwt/dev/jjs/ast/JDeclarationStatement.java
 /trunk/dev/core/src/com/google/gwt/dev/jjs/ast/JModVisitor.java
 /trunk/dev/core/src/com/google/gwt/dev/jjs/ast/JUnaryOperation.java
 /trunk/dev/core/src/com/google/gwt/dev/jjs/ast/JVisitor.java
 /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/TempLocalVisitor.java
 /trunk/dev/core/test/com/google/gwt/dev/jjs/impl/TempLocalVisitorTest.java

===
--- /trunk/dev/core/src/com/google/gwt/dev/jjs/ast/Context.java	Thu Apr  5  
13:07:16 2007
+++ /trunk/dev/core/src/com/google/gwt/dev/jjs/ast/Context.java	Thu Jul  8  
09:38:20 2010

@@ -30,6 +30,8 @@

   void insertBefore(JNode node);

+  boolean isLvalue();
+
   void removeMe();

   void replaceMe(JNode node);
===
--- /trunk/dev/core/src/com/google/gwt/dev/jjs/ast/JBinaryOperation.java	 
Tue Mar  9 10:54:56 2010
+++ /trunk/dev/core/src/com/google/gwt/dev/jjs/ast/JBinaryOperation.java	 
Thu Jul  8 09:38:20 2010

@@ -74,7 +74,11 @@

   public void traverse(JVisitor visitor, Context ctx) {
 if (visitor.visit(this, ctx)) {
-  lhs = visitor.accept(lhs);
+  if (isAssignment()) {
+lhs = visitor.acceptLvalue(lhs);
+  } else {
+lhs = visitor.accept(lhs);
+  }
   rhs = visitor.accept(rhs);
 }
 visitor.endVisit(this, ctx);
===
---  
/trunk/dev/core/src/com/google/gwt/dev/jjs/ast/JDeclarationStatement.java	 
Thu Apr  9 08:41:34 2009
+++  
/trunk/dev/core/src/com/google/gwt/dev/jjs/ast/JDeclarationStatement.java	 
Thu Jul  8 09:38:20 2010

@@ -44,7 +44,7 @@

   public void traverse(JVisitor visitor, Context ctx) {
 if (visitor.visit(this, ctx)) {
-  variableRef = (JVariableRef) visitor.accept(variableRef);
+  variableRef = (JVariableRef) visitor.acceptLvalue(variableRef);
   if (initializer != null) {
 initializer = visitor.accept(initializer);
   }
===
--- /trunk/dev/core/src/com/google/gwt/dev/jjs/ast/JModVisitor.java	Tue  
Mar  9 10:54:56 2010
+++ /trunk/dev/core/src/com/google/gwt/dev/jjs/ast/JModVisitor.java	Thu  
Jul  8 09:38:20 2010

@@ -59,6 +59,10 @@
   list.add(index++, (T) node);
   ctxDidChange = true;
 }
+
+public boolean isLvalue() {
+  return false;
+}

 public void removeMe() {
   checkState();
@@ -137,6 +141,10 @@
   list = Lists.add(list, index++, (T) node);
   ctxDidChange = true;
 }
+
+public boolean isLvalue() {
+  return false;
+}

 public void removeMe() {
   checkState();
@@ -180,6 +188,17 @@
   }
 }
   }
+
+  private class LvalueContext extends NodeContext {
+public LvalueContext() {
+  super(false);
+}
+
+@Override
+public boolean isLvalue() {
+  return true;
+}
+  }

   private static class NodeContext implements Context {
 boolean canRemove;
@@ -190,7 +209,7 @@
 public NodeContext(boolean canRemove) {
   this.canRemove = canRemove;
 }
-
+
 public boolean canInsert() {
   return false;
 }
@@ -206,12 +225,16 @@
 public void insertBefore(JNode node) {
   throw new UnsupportedOperationException("Can't insert before " +  
node);

 }
+
+public boolean isLvalue() {
+  return false;
+}

 public void removeMe() {
   if (!canRemove) {
 throw new UnsupportedOperationException("Can't remove " + node);
   }
-
+
   this.node = null;
   didChange = true;
 }
@@ -242,7 +265,7 @@
   public JNode accept(JNode node) {
 return accept(node, false);
   }
-
+
   @Override
   public JNode accept(JNode node, boolean allowRemove) {
 NodeContext ctx = new NodeContext(allowRemove);
@@ -294,6 +317,18 @@
   throw translateException(ctx.node, e);
 }
   }
+
+  public JExpression acceptLvalue(JExpression expr) {
+LvalueContext ctx = new LvalueContext();
+try {
+  ctx.node = expr;
+  traverse(expr, ctx);
+  didChange |= ctx.didChange;
+  return (JExpression) ctx.node;
+} catch (Throwable e) {
+  throw translateException(expr, e);
+}
+  }

   @Override
   public  void acceptWithInsertRemove(List list) {
===
--- /trunk/dev/core/src/com/google/gwt/dev/jjs/ast/JUnaryOperation.java	Tue  
Mar  9 10:54:56 2010
+++ /trunk/dev/core/src/com/google/gwt/dev/jjs/ast/JUnaryOp

[gwt-contrib] [google-web-toolkit] r8363 committed - Restore rolled-back change r8329, now with a much faster test case tha...

2010-07-08 Thread codesite-noreply

Revision: 8363
Author: r...@google.com
Date: Wed Jul  7 05:39:12 2010
Log: Restore rolled-back change r8329, now with a much faster test case  
that runs in IE


Review at http://gwt-code-reviews.appspot.com/654802

Review by: j...@google.com
http://code.google.com/p/google-web-toolkit/source/detail?r=8363

Modified:
 /trunk/user/src/com/google/gwt/core/client/JsonUtils.java
 /trunk/user/src/com/google/gwt/json/client/JSONParser.java
 /trunk/user/test/com/google/gwt/json/client/JSONTest.java

===
--- /trunk/user/src/com/google/gwt/core/client/JsonUtils.java	Tue Jun 29  
11:59:07 2010
+++ /trunk/user/src/com/google/gwt/core/client/JsonUtils.java	Wed Jul  7  
05:39:12 2010

@@ -22,38 +22,117 @@
   @SuppressWarnings("unused")
   private static JavaScriptObject escapeTable = initEscapeTable();

+  @SuppressWarnings("unused")
+  private static final boolean hasJsonParse = hasJsonParse();
+
+  /**
+   * Escapes characters within a JSON string than cannot be passed  
directly to

+   * eval(). Control characters, quotes and backslashes are not affected.
+   */
+  public static native String escapeJsonForEval(String toEscape) /*-{
+var s =  
toEscape.replace(/[\xad\u0600-\u0603\u06dd\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202e\u2060-\u2063\u206a-\u206f\ufeff\ufff9-\ufffb]/g,  
function(x) {
+  return  
@com.google.gwt.core.client.JsonUtils::escapeChar(Ljava/lang/String;)(x);

+});
+return s;
+  }-*/;
+
   /**
* Returns a quoted, escaped JSON String.
*/
   public static native String escapeValue(String toEscape) /*-{
-var s = toEscape.replace(/[\x00-\x1F\u2028\u2029"\\]/g, function(x) {
+var s =  
toEscape.replace(/[\x00-\x1f\xad\u0600-\u0603\u06dd\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202e\u2060-\u2063\u206a-\u206f\ufeff\ufff9-\ufffb"\\]/g,  
function(x) {
   return  
@com.google.gwt.core.client.JsonUtils::escapeChar(Ljava/lang/String;)(x);

 });
 return "\"" + s + "\"";
   }-*/;

-  /*
-   * TODO: Implement safeEval using a proper parser.
+  /**
+   * Evaluates a JSON expression safely. The payload must evaluate to an  
Object

+   * or an Array (not a primitive or a String).
+   *
+   * @param  The type of JavaScriptObject that should be returned
+   * @param json The source JSON text
+   * @return The evaluated object
+   *
+   * @throws IllegalArgumentException if the input is not valid JSON
*/
-
+  public static native  T safeEval(String  
json) /*-{

+var v;
+if (@com.google.gwt.core.client.JsonUtils::hasJsonParse) {
+  try {
+return JSON.parse(json);
+  } catch (e) {
+return  
@com.google.gwt.core.client.JsonUtils::throwIllegalArgumentException(Ljava/lang/String;)("Error  
parsing JSON: " + e);

+  }
+} else {
+  if  
(!...@com.google.gwt.core.client.jsonutils::safeToEval(Ljava/lang/String;)(json))  
{
+return  
@com.google.gwt.core.client.JsonUtils::throwIllegalArgumentException(Ljava/lang/String;)("Illegal  
character in JSON string");

+  }
+  json =  
@com.google.gwt.core.client.JsonUtils::escapeJsonForEval(Ljava/lang/String;)(json);

+  try {
+return eval('(' + json + ')');
+  } catch (e) {
+return  
@com.google.gwt.core.client.JsonUtils::throwIllegalArgumentException(Ljava/lang/String;)("Error  
parsing JSON: " + e);

+  }
+}
+  }-*/;
+
   /**
-   * Evaluates a JSON expression. This method does not validate the JSON  
text

-   * and should only be used on JSON from trusted sources.
+   * Returns true if the given JSON string may be safely evaluated by  
{...@code
+   * eval()} without undersired side effects or security risks. Note that  
a true
+   * result from this method does not guarantee that the input string is  
valid
+   * JSON.  This method does not consider the contents of quoted strings;  
it
+   * may still be necessary to perform escaping prior to evaluation for  
correct

+   * results.
+   *
+   *  The technique used is taken from href="http://www.ietf.org/rfc/rfc4627.txt";>RFC 4627.

+   */
+  public static native boolean safeToEval(String text) /*-{
+// Remove quoted strings and disallow anything except:
+//
+// 1) symbols and brackets ,:{}[]
+// 2) numbers: digits 0-9, ., -, +, e, and E
+// 3) literal values: 'null', 'true' and 'false' = [aeflnr-u]
+// 4) whitespace: ' ', '\n', '\r', and '\t'
+return !(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(text.replace(/"(\\.| 
[^"\\])*"/g, '')));

+  }-*/;
+
+  /**
+   * Evaluates a JSON expression using {...@code eval()}. This method does not
+   * validate the JSON text and should only be used on JSON from trusted
+   * sources. The payload must evaluate to an Object or an Array (not a
+   * primitive or a String).
*
* @param  The type of JavaScriptObject that should be returned
* @param json The source JSON text
* @return The evaluated object
*/
   public static native  T unsafeEval(String  
json) /*-{

-return eva

[gwt-contrib] [google-web-toolkit] r8364 committed - Add numeric wrappers to JavaResourceBase....

2010-07-08 Thread codesite-noreply

Revision: 8364
Author: to...@google.com
Date: Thu Jul  8 06:50:03 2010
Log: Add numeric wrappers to JavaResourceBase.

Review at http://gwt-code-reviews.appspot.com/673801

Review by: sco...@google.com
http://code.google.com/p/google-web-toolkit/source/detail?r=8364

Modified:
 /trunk/dev/core/test/com/google/gwt/dev/javac/impl/JavaResourceBase.java

===
---  
/trunk/dev/core/test/com/google/gwt/dev/javac/impl/JavaResourceBase.java	 
Fri Jun  4 12:47:18 2010
+++  
/trunk/dev/core/test/com/google/gwt/dev/javac/impl/JavaResourceBase.java	 
Thu Jul  8 06:50:03 2010

@@ -41,6 +41,40 @@
   code.append("}\n");
   return code;
 }
+  };
+  public static final MockJavaResource BYTE = new MockJavaResource(
+  "java.lang.Byte") {
+@Override
+protected CharSequence getContent() {
+  StringBuffer code = new StringBuffer();
+  code.append("package java.lang;\n");
+  code.append("public class Byte extends Number {\n");
+  code.append("  private byte value;\n");
+  code.append("  public Byte(byte value) {\n");
+  code.append("this.value = value;\n");
+  code.append("  }\n");
+  code.append("  public static Byte valueOf(byte b) { return new  
Byte(b); }\n");

+  code.append("  public byte byteValue() { return value; }\n");
+  code.append("}\n");
+  return code;
+}
+  };
+  public static final MockJavaResource CHARACTER = new MockJavaResource(
+  "java.lang.Character") {
+@Override
+protected CharSequence getContent() {
+  StringBuffer code = new StringBuffer();
+  code.append("package java.lang;\n");
+  code.append("public class Character {\n");
+  code.append("  private char value;\n");
+  code.append("  public Character(char value) {\n");
+  code.append("this.value = value;\n");
+  code.append("  }\n");
+  code.append("  public static Character valueOf(char c) { return new  
Character(c); }\n");

+  code.append("  public char charValue() { return value; }\n");
+  code.append("}\n");
+  return code;
+}
   };
   public static final MockJavaResource CLASS = new MockJavaResource(
   "java.lang.Class") {
@@ -88,7 +122,7 @@
 protected CharSequence getContent() {
   StringBuffer code = new StringBuffer();
   code.append("package java.lang;\n");
-  code.append("public class Double {\n");
+  code.append("public class Double extends Number {\n");
   code.append("  private double value;\n");
   code.append("  public Double(double value) {\n");
   code.append("this.value = value;\n");
@@ -141,7 +175,7 @@
 protected CharSequence getContent() {
   StringBuffer code = new StringBuffer();
   code.append("package java.lang;\n");
-  code.append("public class Float {\n");
+  code.append("public class Float extends Number {\n");
   code.append("  private float value;\n");
   code.append("  public Float(float value) {\n");
   code.append("this.value = value;\n");
@@ -169,7 +203,7 @@
 protected CharSequence getContent() {
   StringBuffer code = new StringBuffer();
   code.append("package java.lang;\n");
-  code.append("public class Integer {\n");
+  code.append("public class Integer extends Number {\n");
   code.append("  private int value;\n");
   code.append("  public Integer(int value) {\n");
   code.append("this.value = value;\n");
@@ -226,6 +260,18 @@
   return code;
 }
   };
+  public static final MockJavaResource NUMBER = new MockJavaResource(
+  "java.lang.Number") {
+@Override
+protected CharSequence getContent() {
+  StringBuffer code = new StringBuffer();
+  code.append("package java.lang;\n");
+  code.append("public class Number implements java.io.Serializable  
{\n");

+  code.append("}\n");
+  return code;
+}
+  };
+
   public static final MockJavaResource OBJECT = new MockJavaResource(
   "java.lang.Object") {
 @Override
@@ -249,6 +295,23 @@
   code.append("public interface Serializable { }\n");
   return code;
 }
+  };
+  public static final MockJavaResource SHORT = new MockJavaResource(
+  "java.lang.Short") {
+@Override
+protected CharSequence getContent() {
+  StringBuffer code = new StringBuffer();
+  code.append("package java.lang;\n");
+  code.append("public class Short extends Number {\n");
+  code.append("  private short value;\n");
+  code.append("  public Short(short value) {\n");
+  code.append("this.value = value;\n");
+  code.append("  }\n");
+  code.append("  public static Short valueOf(short s) { return new  
Short(s); }\n");

+  code.append("  public short shortValue() { return value; }\n");
+  code.append("}\n");
+  return code;
+}
   };
   public static final MockJavaResource STRING = new MockJavaResource(
   "java.lang.String") {
@@ -317,9 +380,10 @@

   public static MockJavaResource[] getStand

[gwt-contrib] [google-web-toolkit] r8366 committed - JSNI ::new() now targets constructors directly....

2010-07-08 Thread codesite-noreply

Revision: 8366
Author: sco...@google.com
Date: Thu Jul  8 08:08:57 2010
Log: JSNI ::new() now targets constructors directly.

This patch removes the extra hop through a synthetic static 'new' function  
that is currently used for implementing JSNI ::new() invocations.


In the 99% case, the JsInvocation is replaced with a JsNew operation on the  
target constructor.  In rare cases where the constructor is not immediately  
invoked, a tear off function is creation which performs the new op  
internally.


Review by: to...@google.com
http://code.google.com/p/google-web-toolkit/source/detail?r=8366

Modified:
 /trunk/dev/core/src/com/google/gwt/dev/jjs/ast/JVisitor.java
 /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/BuildTypeMap.java
 /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/ControlFlowAnalyzer.java
 /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaAST.java
 /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaScriptAST.java
 /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/JsniRefLookup.java
 /trunk/dev/core/test/com/google/gwt/dev/jjs/impl/JsniRefLookupTest.java

===
--- /trunk/dev/core/src/com/google/gwt/dev/jjs/ast/JVisitor.java	Fri Apr  2  
14:35:01 2010
+++ /trunk/dev/core/src/com/google/gwt/dev/jjs/ast/JVisitor.java	Thu Jul  8  
08:08:57 2010

@@ -698,7 +698,7 @@
   }

   public boolean visit(JsniMethodRef x, Context ctx) {
-/* NOTE: Skip JMethodRef */
+/* NOTE: Skip JMethodCall */
 return visit((JExpression) x, ctx);
   }

===
--- /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/BuildTypeMap.java	Thu  
Jul  8 08:05:07 2010
+++ /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/BuildTypeMap.java	Thu  
Jul  8 08:08:57 2010

@@ -28,13 +28,10 @@
 import com.google.gwt.dev.jjs.ast.JLocal;
 import com.google.gwt.dev.jjs.ast.JMethod;
 import com.google.gwt.dev.jjs.ast.JMethodBody;
-import com.google.gwt.dev.jjs.ast.JNewInstance;
 import com.google.gwt.dev.jjs.ast.JParameter;
-import com.google.gwt.dev.jjs.ast.JParameterRef;
 import com.google.gwt.dev.jjs.ast.JPrimitiveType;
 import com.google.gwt.dev.jjs.ast.JProgram;
 import com.google.gwt.dev.jjs.ast.JReferenceType;
-import com.google.gwt.dev.jjs.ast.JReturnStatement;
 import com.google.gwt.dev.jjs.ast.JType;
 import com.google.gwt.dev.jjs.ast.JField.Disposition;
 import com.google.gwt.dev.jjs.ast.js.JsniMethodBody;
@@ -219,13 +216,6 @@
 }

 typeMap.put(b, newCtor);
-
-// Now let's implicitly create a static function called 'new' that  
will

-// allow construction from JSNI methods
-if (!enclosingType.isAbstract()) {
-  createSyntheticConstructor(newCtor);
-}
-
 return true;
   } catch (Throwable e) {
 throw translateException(ctorDecl, e);
@@ -387,63 +377,6 @@
   enclosingMethod);
   return param;
 }
-
-/**
- * Create a method that invokes the specified constructor. This is  
done as
- * an aid to JSNI users to be able to invoke a Java constructor via a  
method

- * named ::new.
- *
- * @param constructor the constructor to invoke
- * @param staticClass indicates if the class being constructed is  
static

- * @param enclosingType the type that encloses the type that is to be
- *  constructed. This may be null if the class is  
a

- *  top-level type.
- */
-private JMethod createSyntheticConstructor(JConstructor constructor) {
-  JClassType type = constructor.getEnclosingType();
-
-  // Define the method
-  JMethod synthetic =  
program.createMethod(type.getSourceInfo().makeChild(

-  BuildDeclMapVisitor.class, "Synthetic constructor"), "new", type,
-  program.getNonNullType(type), false, true, true, false, false);
-  synthetic.setSynthetic();
-
-  synthetic.addThrownExceptions(constructor.getThrownExceptions());
-
-  // new Foo() : Create the instance
-  JNewInstance newInstance = new JNewInstance(
-  type.getSourceInfo().makeChild(BuildDeclMapVisitor.class,
-  "new instance"), constructor, type);
-
-  /*
-   * In one pass, add the parameters to the synthetic constructor and
-   * arguments to the method call.
-   */
-  for (JParameter param : constructor.getParams()) {
-JParameter syntheticParam = JProgram.createParameter(
-synthetic.getSourceInfo().makeChild(BuildDeclMapVisitor.class,
-"Argument " + param.getName()), param.getName(),
-param.getType(), true, false, synthetic);
-newInstance.addArg(new JParameterRef(
- 
syntheticParam.getSourceInfo().makeChild(BuildDeclMapVisitor.class,

-"reference"), syntheticParam));
-  }
-
-  // Lock the method.
-  synthetic.freezeParamTypes();
-
-  // return new Foo() : The only statement in the function
-  JReturnStatement ret = new JReturnStatement(
-  synthetic.

[gwt-contrib] [google-web-toolkit] r8369 committed - Update 2.1 M2 Maven repo with updated M2 artifacts.

2010-07-08 Thread codesite-noreply

Revision: 8369
Author: jasonpar...@google.com
Date: Thu Jul  8 13:56:20 2010
Log: Update 2.1 M2 Maven repo with updated M2 artifacts.
http://code.google.com/p/google-web-toolkit/source/detail?r=8369

Modified:
 /2.1.0.M2/gwt/maven/com/google/gwt/gwt-dev/2.1.0.M2/gwt-dev-2.1.0.M2.jar
  
/2.1.0.M2/gwt/maven/com/google/gwt/gwt-dev/2.1.0.M2/gwt-dev-2.1.0.M2.jar.md5
  
/2.1.0.M2/gwt/maven/com/google/gwt/gwt-dev/2.1.0.M2/gwt-dev-2.1.0.M2.jar.sha1

 /2.1.0.M2/gwt/maven/com/google/gwt/gwt-dev/maven-metadata.xml
 /2.1.0.M2/gwt/maven/com/google/gwt/gwt-dev/maven-metadata.xml.md5
 /2.1.0.M2/gwt/maven/com/google/gwt/gwt-dev/maven-metadata.xml.sha1
  
/2.1.0.M2/gwt/maven/com/google/gwt/gwt-servlet/2.1.0.M2/gwt-servlet-2.1.0.M2.jar
  
/2.1.0.M2/gwt/maven/com/google/gwt/gwt-servlet/2.1.0.M2/gwt-servlet-2.1.0.M2.jar.md5
  
/2.1.0.M2/gwt/maven/com/google/gwt/gwt-servlet/2.1.0.M2/gwt-servlet-2.1.0.M2.jar.sha1

 /2.1.0.M2/gwt/maven/com/google/gwt/gwt-servlet/maven-metadata.xml
 /2.1.0.M2/gwt/maven/com/google/gwt/gwt-servlet/maven-metadata.xml.md5
 /2.1.0.M2/gwt/maven/com/google/gwt/gwt-servlet/maven-metadata.xml.sha1
  
/2.1.0.M2/gwt/maven/com/google/gwt/gwt-soyc-vis/2.1.0.M2/gwt-soyc-vis-2.1.0.M2.jar
  
/2.1.0.M2/gwt/maven/com/google/gwt/gwt-soyc-vis/2.1.0.M2/gwt-soyc-vis-2.1.0.M2.jar.md5
  
/2.1.0.M2/gwt/maven/com/google/gwt/gwt-soyc-vis/2.1.0.M2/gwt-soyc-vis-2.1.0.M2.jar.sha1

 /2.1.0.M2/gwt/maven/com/google/gwt/gwt-soyc-vis/maven-metadata.xml
 /2.1.0.M2/gwt/maven/com/google/gwt/gwt-soyc-vis/maven-metadata.xml.md5
 /2.1.0.M2/gwt/maven/com/google/gwt/gwt-soyc-vis/maven-metadata.xml.sha1
 /2.1.0.M2/gwt/maven/com/google/gwt/gwt-user/2.1.0.M2/gwt-user-2.1.0.M2.jar
  
/2.1.0.M2/gwt/maven/com/google/gwt/gwt-user/2.1.0.M2/gwt-user-2.1.0.M2.jar.md5
  
/2.1.0.M2/gwt/maven/com/google/gwt/gwt-user/2.1.0.M2/gwt-user-2.1.0.M2.jar.sha1

 /2.1.0.M2/gwt/maven/com/google/gwt/gwt-user/maven-metadata.xml
 /2.1.0.M2/gwt/maven/com/google/gwt/gwt-user/maven-metadata.xml.md5
 /2.1.0.M2/gwt/maven/com/google/gwt/gwt-user/maven-metadata.xml.sha1

===
---  
/2.1.0.M2/gwt/maven/com/google/gwt/gwt-dev/2.1.0.M2/gwt-dev-2.1.0.M2.jar	 
Fri Jul  2 10:29:54 2010
+++  
/2.1.0.M2/gwt/maven/com/google/gwt/gwt-dev/2.1.0.M2/gwt-dev-2.1.0.M2.jar	 
Thu Jul  8 13:56:20 2010

File is too large to display a diff.
===
---  
/2.1.0.M2/gwt/maven/com/google/gwt/gwt-dev/2.1.0.M2/gwt-dev-2.1.0.M2.jar.md5	 
Fri Jul  2 10:29:54 2010
+++  
/2.1.0.M2/gwt/maven/com/google/gwt/gwt-dev/2.1.0.M2/gwt-dev-2.1.0.M2.jar.md5	 
Thu Jul  8 13:56:20 2010

@@ -1,1 +1,1 @@
-e6e946bb45e8d20b98cf374e969c417b
+34d17a1d650e7bc7982d6f7dd2d96152
===
---  
/2.1.0.M2/gwt/maven/com/google/gwt/gwt-dev/2.1.0.M2/gwt-dev-2.1.0.M2.jar.sha1	 
Fri Jul  2 10:29:54 2010
+++  
/2.1.0.M2/gwt/maven/com/google/gwt/gwt-dev/2.1.0.M2/gwt-dev-2.1.0.M2.jar.sha1	 
Thu Jul  8 13:56:20 2010

@@ -1,1 +1,1 @@
-683b8e4f09a34262f399ad6963a4941df7388a83
+8d7b35b70f1309f790bda19f131445bfb20fd66a
===
--- /2.1.0.M2/gwt/maven/com/google/gwt/gwt-dev/maven-metadata.xml	Fri Jul   
2 10:29:54 2010
+++ /2.1.0.M2/gwt/maven/com/google/gwt/gwt-dev/maven-metadata.xml	Thu Jul   
8 13:56:20 2010

@@ -7,6 +7,6 @@
 
   2.1.0.M2
 
-20100701144018
+20100708204159
   
 
===
--- /2.1.0.M2/gwt/maven/com/google/gwt/gwt-dev/maven-metadata.xml.md5	Fri  
Jul  2 10:29:54 2010
+++ /2.1.0.M2/gwt/maven/com/google/gwt/gwt-dev/maven-metadata.xml.md5	Thu  
Jul  8 13:56:20 2010

@@ -1,1 +1,1 @@
-83c996c9a5333cc1f5547fb88a3db0a7
+87a38fb30b2744cd3554a86d496c6357
===
--- /2.1.0.M2/gwt/maven/com/google/gwt/gwt-dev/maven-metadata.xml.sha1	Fri  
Jul  2 10:29:54 2010
+++ /2.1.0.M2/gwt/maven/com/google/gwt/gwt-dev/maven-metadata.xml.sha1	Thu  
Jul  8 13:56:20 2010

@@ -1,1 +1,1 @@
-e500018ffabacf49c5825bc66dee0e26ffc68f74
+807356d40925bda386a79cd5da37bee7647d243e
===
---  
/2.1.0.M2/gwt/maven/com/google/gwt/gwt-servlet/2.1.0.M2/gwt-servlet-2.1.0.M2.jar	 
Fri Jul  2 10:29:54 2010
+++  
/2.1.0.M2/gwt/maven/com/google/gwt/gwt-servlet/2.1.0.M2/gwt-servlet-2.1.0.M2.jar	 
Thu Jul  8 13:56:20 2010

File is too large to display a diff.
===
---  
/2.1.0.M2/gwt/maven/com/google/gwt/gwt-servlet/2.1.0.M2/gwt-servlet-2.1.0.M2.jar.md5	 
Fri Jul  2 10:29:54 2010
+++  
/2.1.0.M2/gwt/maven/com/google/gwt/gwt-servlet/2.1.0.M2/gwt-servlet-2.1.0.M2.jar.md5	 
Thu Jul  8 13:56:20 2010

@@ -1,1 +1,1 @@
-47ac05333b23bd169653b8ab9f932845
+c2e79bd9c491d1f97d279917420514f8
===
---  
/2.1.0.M2/gwt/maven/com/google/gwt/gwt-servlet/2.1.0.M2/gwt-servlet-2.1.0.M2.jar.sha1	 
Fri Jul  2 10:29:54 2010
+++  
/2.1.0.M2/gwt/maven/com/google/gwt/gwt-servlet/2.1.0.M2/gwt-servlet-2.1.0.M2.jar.sha1	 
Thu Jul  8 13:56:20 2010

@@ -1,1 +1,1 @@
-14cf49f1f949925cb26cd09

[gwt-contrib] [google-web-toolkit] r8365 committed - Reorder outer 'this' constructor arguments to come before user argumen...

2010-07-08 Thread codesite-noreply

Revision: 8365
Author: sco...@google.com
Date: Thu Jul  8 08:05:07 2010
Log: Reorder outer 'this' constructor arguments to come before user  
arguments.


The main purpose of this change is to remove the impedance mismatch between  
our constructor argument order, and the argument order for JSNI ::new()  
invocations. Our constructors put the synthetic this args after user args,  
JSNI ::new() puts the args before user args.


Once this impedance mismatch is cleared up, in a follow up change I plan to  
remove the static synthetic 'new' methods in favor of targeting the  
constructors directly.


http://gwt-code-reviews.appspot.com/675801/show
Review by: tobyr

http://code.google.com/p/google-web-toolkit/source/detail?r=8365

Modified:
 /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/BuildTypeMap.java
 /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaAST.java

===
--- /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/BuildTypeMap.java	Thu  
Jun 24 15:39:22 2010
+++ /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/BuildTypeMap.java	Thu  
Jul  8 08:05:07 2010

@@ -77,7 +77,6 @@

 import java.util.ArrayList;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Set;

@@ -177,19 +176,11 @@
   program.getTypePrimitiveInt(), true, false, newCtor);
 }

-// user args
-mapParameters(newCtor, ctorDecl);
-addThrownExceptions(ctorDecl.binding, newCtor);
-// original params are now frozen
-
-info.addCorrelation(program.getCorrelator().by(newCtor));
-
-int syntheticParamCount = 0;
 ReferenceBinding declaringClass = b.declaringClass;
+Set alreadyNamedVariables = new HashSet();
 if (declaringClass.isNestedType() && !declaringClass.isStatic()) {
-  // add synthetic args for outer this and locals
+  // add synthetic args for outer this
   NestedTypeBinding nestedBinding = (NestedTypeBinding)  
declaringClass;

-  Set alreadyNamedVariables = new HashSet();
   if (nestedBinding.enclosingInstances != null) {
 for (int i = 0; i < nestedBinding.enclosingInstances.length;  
++i) {
   SyntheticArgumentBinding arg =  
nestedBinding.enclosingInstances[i];

@@ -198,11 +189,22 @@
 argName += "_" + i;
   }
   createParameter(arg, argName, newCtor);
-  ++syntheticParamCount;
   alreadyNamedVariables.add(argName);
 }
   }
-
+}
+
+// user args
+mapParameters(newCtor, ctorDecl);
+// original params are now frozen
+
+addThrownExceptions(ctorDecl.binding, newCtor);
+
+info.addCorrelation(program.getCorrelator().by(newCtor));
+
+if (declaringClass.isNestedType() && !declaringClass.isStatic()) {
+  // add synthetic args for locals
+  NestedTypeBinding nestedBinding = (NestedTypeBinding)  
declaringClass;

   if (nestedBinding.outerLocalVariables != null) {
 for (int i = 0; i < nestedBinding.outerLocalVariables.length;  
++i) {
   SyntheticArgumentBinding arg =  
nestedBinding.outerLocalVariables[i];

@@ -211,7 +213,6 @@
 argName += "_" + i;
   }
   createParameter(arg, argName, newCtor);
-  ++syntheticParamCount;
   alreadyNamedVariables.add(argName);
 }
   }
@@ -222,11 +223,7 @@
 // Now let's implicitly create a static function called 'new' that  
will

 // allow construction from JSNI methods
 if (!enclosingType.isAbstract()) {
-  ReferenceBinding enclosingBinding =  
ctorDecl.binding.declaringClass.enclosingType();

-  JReferenceType outerType = enclosingBinding == null ? null
-  : (JReferenceType) typeMap.get(enclosingBinding);
-  createSyntheticConstructor(newCtor,
-  ctorDecl.binding.declaringClass.isStatic(), outerType);
+  createSyntheticConstructor(newCtor);
 }

 return true;
@@ -402,8 +399,7 @@
  *  constructed. This may be null if the class is  
a

  *  top-level type.
  */
-private JMethod createSyntheticConstructor(JConstructor constructor,
-boolean staticClass, JReferenceType enclosingType) {
+private JMethod createSyntheticConstructor(JConstructor constructor) {
   JClassType type = constructor.getEnclosingType();

   // Define the method
@@ -418,43 +414,19 @@
   JNewInstance newInstance = new JNewInstance(
   type.getSourceInfo().makeChild(BuildDeclMapVisitor.class,
   "new instance"), constructor, type);
-
-  /*
-   * If the type isn't static, make the first parameter a reference to  
the
-   * instance of the enclosing class. It's the first instance to allow  
the

-   * JSNI qualifier to be moved without affecting evaluation order.
- 

[gwt-contrib] [google-web-toolkit] r8367 committed - Updated the target in maven repo to M2....

2010-07-08 Thread codesite-noreply

Revision: 8367
Author: amitman...@google.com
Date: Thu Jul  8 08:12:05 2010
Log: Updated the target in maven repo to M2.

Patch by: amitmanjhi
Review by: jasonparekh

http://code.google.com/p/google-web-toolkit/source/detail?r=8367

Modified:
 /trunk/tools/scripts/maven_script.sh

===
--- /trunk/tools/scripts/maven_script.shFri Jun 25 08:42:47 2010
+++ /trunk/tools/scripts/maven_script.shThu Jul  8 08:12:05 2010
@@ -22,8 +22,8 @@

 for i in dev user servlet
 do
-   mvn install:install-file -DgroupId=com.google.gwt -DartifactId=gwt-${i}  
-Dversion=2.1.0.M1 -Dpackaging=jar -Dfile=build/lib/gwt-${i}.jar  
-DgeneratePom=true
+   mvn install:install-file -DgroupId=com.google.gwt -DartifactId=gwt-${i}  
-Dversion=2.1.0.M2 -Dpackaging=jar -Dfile=build/lib/gwt-${i}.jar  
-DgeneratePom=true

 done
 touch /tmp/empty-fake-soyc-vis.jar
-mvn install:install-file -DgroupId=com.google.gwt  
-DartifactId=gwt-soyc-vis -Dversion=2.1.0.M1 -Dpackaging=jar  
-DgeneratePom=true -Dfile=/tmp/empty-fake-soyc-vis.jar
+mvn install:install-file -DgroupId=com.google.gwt  
-DartifactId=gwt-soyc-vis -Dversion=2.1.0.M2 -Dpackaging=jar  
-DgeneratePom=true -Dfile=/tmp/empty-fake-soyc-vis.jar

 echo "installed the gwt libs in the maven repo"

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors


Re: [gwt-contrib] [google-web-toolkit] r8369 committed - Update 2.1 M2 Maven repo with updated M2 artifacts.

2010-07-08 Thread Daniel Bell
Hi Guys,
I just noticed that there was an update to the Maven artefacts for M2.
Without meaning to be presumptuous, I just wanted to check that you know
that current users of M2 with Maven won't receive the updates from the
repository because the artefacts aren't snapshots. To receive the updates,
they'll need to delete the existing ones from their local repositories.
Please ignore if I've missed the point!
Cheers,
Daniel

On 9 July 2010 08:20,  wrote:

> Revision: 8369
> Author: jasonpar...@google.com
> Date: Thu Jul  8 13:56:20 2010
> Log: Update 2.1 M2 Maven repo with updated M2 artifacts.
> http://code.google.com/p/google-web-toolkit/source/detail?r=8369
>
> Modified:
>  /2.1.0.M2/gwt/maven/com/google/gwt/gwt-dev/2.1.0.M2/gwt-dev-2.1.0.M2.jar
>
>  /2.1.0.M2/gwt/maven/com/google/gwt/gwt-dev/2.1.0.M2/gwt-dev-2.1.0.M2.jar.md5
>
>  /2.1.0.M2/gwt/maven/com/google/gwt/gwt-dev/2.1.0.M2/gwt-dev-2.1.0.M2.jar.sha1
>  /2.1.0.M2/gwt/maven/com/google/gwt/gwt-dev/maven-metadata.xml
>  /2.1.0.M2/gwt/maven/com/google/gwt/gwt-dev/maven-metadata.xml.md5
>  /2.1.0.M2/gwt/maven/com/google/gwt/gwt-dev/maven-metadata.xml.sha1
>
>  
> /2.1.0.M2/gwt/maven/com/google/gwt/gwt-servlet/2.1.0.M2/gwt-servlet-2.1.0.M2.jar
>
>  
> /2.1.0.M2/gwt/maven/com/google/gwt/gwt-servlet/2.1.0.M2/gwt-servlet-2.1.0.M2.jar.md5
>
>  
> /2.1.0.M2/gwt/maven/com/google/gwt/gwt-servlet/2.1.0.M2/gwt-servlet-2.1.0.M2.jar.sha1
>  /2.1.0.M2/gwt/maven/com/google/gwt/gwt-servlet/maven-metadata.xml
>  /2.1.0.M2/gwt/maven/com/google/gwt/gwt-servlet/maven-metadata.xml.md5
>  /2.1.0.M2/gwt/maven/com/google/gwt/gwt-servlet/maven-metadata.xml.sha1
>
>  
> /2.1.0.M2/gwt/maven/com/google/gwt/gwt-soyc-vis/2.1.0.M2/gwt-soyc-vis-2.1.0.M2.jar
>
>  
> /2.1.0.M2/gwt/maven/com/google/gwt/gwt-soyc-vis/2.1.0.M2/gwt-soyc-vis-2.1.0.M2.jar.md5
>
>  
> /2.1.0.M2/gwt/maven/com/google/gwt/gwt-soyc-vis/2.1.0.M2/gwt-soyc-vis-2.1.0.M2.jar.sha1
>  /2.1.0.M2/gwt/maven/com/google/gwt/gwt-soyc-vis/maven-metadata.xml
>  /2.1.0.M2/gwt/maven/com/google/gwt/gwt-soyc-vis/maven-metadata.xml.md5
>  /2.1.0.M2/gwt/maven/com/google/gwt/gwt-soyc-vis/maven-metadata.xml.sha1
>  /2.1.0.M2/gwt/maven/com/google/gwt/gwt-user/2.1.0.M2/gwt-user-2.1.0.M2.jar
>
>  
> /2.1.0.M2/gwt/maven/com/google/gwt/gwt-user/2.1.0.M2/gwt-user-2.1.0.M2.jar.md5
>
>  
> /2.1.0.M2/gwt/maven/com/google/gwt/gwt-user/2.1.0.M2/gwt-user-2.1.0.M2.jar.sha1
>  /2.1.0.M2/gwt/maven/com/google/gwt/gwt-user/maven-metadata.xml
>  /2.1.0.M2/gwt/maven/com/google/gwt/gwt-user/maven-metadata.xml.md5
>  /2.1.0.M2/gwt/maven/com/google/gwt/gwt-user/maven-metadata.xml.sha1
>
> ===
> ---
> /2.1.0.M2/gwt/maven/com/google/gwt/gwt-dev/2.1.0.M2/gwt-dev-2.1.0.M2.jar
>  Fri Jul  2 10:29:54 2010
> +++
> /2.1.0.M2/gwt/maven/com/google/gwt/gwt-dev/2.1.0.M2/gwt-dev-2.1.0.M2.jar
>  Thu Jul  8 13:56:20 2010
> File is too large to display a diff.
> ===
> ---
> /2.1.0.M2/gwt/maven/com/google/gwt/gwt-dev/2.1.0.M2/gwt-dev-2.1.0.M2.jar.md5
>Fri Jul  2 10:29:54 2010
> +++
> /2.1.0.M2/gwt/maven/com/google/gwt/gwt-dev/2.1.0.M2/gwt-dev-2.1.0.M2.jar.md5
>Thu Jul  8 13:56:20 2010
> @@ -1,1 +1,1 @@
> -e6e946bb45e8d20b98cf374e969c417b
> +34d17a1d650e7bc7982d6f7dd2d96152
> ===
> ---
> /2.1.0.M2/gwt/maven/com/google/gwt/gwt-dev/2.1.0.M2/gwt-dev-2.1.0.M2.jar.sha1
>   Fri Jul  2 10:29:54 2010
> +++
> /2.1.0.M2/gwt/maven/com/google/gwt/gwt-dev/2.1.0.M2/gwt-dev-2.1.0.M2.jar.sha1
>   Thu Jul  8 13:56:20 2010
> @@ -1,1 +1,1 @@
> -683b8e4f09a34262f399ad6963a4941df7388a83
> +8d7b35b70f1309f790bda19f131445bfb20fd66a
> ===
> --- /2.1.0.M2/gwt/maven/com/google/gwt/gwt-dev/maven-metadata.xml   Fri
> Jul  2 10:29:54 2010
> +++ /2.1.0.M2/gwt/maven/com/google/gwt/gwt-dev/maven-metadata.xml   Thu
> Jul  8 13:56:20 2010
> @@ -7,6 +7,6 @@
> 
>   2.1.0.M2
> 
> -20100701144018
> +20100708204159
>   
>  
> ===
> --- /2.1.0.M2/gwt/maven/com/google/gwt/gwt-dev/maven-metadata.xml.md5   Fri
> Jul  2 10:29:54 2010
> +++ /2.1.0.M2/gwt/maven/com/google/gwt/gwt-dev/maven-metadata.xml.md5   Thu
> Jul  8 13:56:20 2010
> @@ -1,1 +1,1 @@
> -83c996c9a5333cc1f5547fb88a3db0a7
> +87a38fb30b2744cd3554a86d496c6357
> ===
> --- /2.1.0.M2/gwt/maven/com/google/gwt/gwt-dev/maven-metadata.xml.sha1  Fri
> Jul  2 10:29:54 2010
> +++ /2.1.0.M2/gwt/maven/com/google/gwt/gwt-dev/maven-metadata.xml.sha1  Thu
> Jul  8 13:56:20 2010
> @@ -1,1 +1,1 @@
> -e500018ffabacf49c5825bc66dee0e26ffc68f74
> +807356d40925bda386a79cd5da37bee7647d243e
> ===
> ---
> /2.1.0.M2/gwt/maven/com/google/gwt/gwt-servlet/2.1.0.M2/gwt-servlet-2.1.0.M2.jar
>Fri Jul  2 10:29:54 2010
> +++
> /2.1.0.M2/gwt/maven/com/google/gwt/gwt-servlet/2.1.0.M2/gwt-servlet-2.1.0.M2.jar
>Thu Jul  8 13:56:20 2010
> File is too large to display a diff.
> 

Re: [gwt-contrib] History token encoding issues

2010-07-08 Thread Stephen Haberman

> I settled for an alternate implementation of HistoryImpl that can be
> seen on the rawhistory branch of our gwt-traction project here:

FWIW, I think this is a good idea. Thanks for linking to your other
HistoryImpl--I will keep the link handy.

- Stephen

-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors