[gwt-contrib] [google-web-toolkit commit] r5604 - no log message

2009-06-23 Thread codesite-noreply

Author: br...@google.com
Date: Mon Jun 22 23:40:46 2009
New Revision: 5604

Modified:
wiki/LightweightCollections.wiki

Log:


Modified: wiki/LightweightCollections.wiki
==
--- wiki/LightweightCollections.wiki(original)
+++ wiki/LightweightCollections.wikiMon Jun 22 23:40:46 2009
@@ -44,6 +44,4 @@

  _Publish and guarantee time complexity for various operations._

-_Keep implementations locked down._ Because it's very tricky to get the  
implementations for these sorts of collections just right, the plan is to  
minimize ways in which there could be confusion about the implementation of  
a given collection type. More concretely, the key types should be classes  
rather than interfaces so that their implementation can be restricted to  
the package in which they are defined. If developers cannot trust that a  
given collection instance is truly optimal and maintains time complexity  
guarantees -- as might be the case if collections types were interfaces  
which could have been implemented anywhere -- then they may feel  
compelled to write defensive code. By locking the implementations down,  
developers can rely on the behavior of a given collection type.
-
-
+_Keep implementations locked down._ Because it's very tricky to get the  
implementations for these sorts of collections just right, the plan is to  
minimize ways in which there could be confusion about the implementation of  
a given collection type. More concretely, the key types should be classes  
rather than interfaces so that their implementation can be restricted to  
the package in which they are defined. If developers cannot trust that a  
given collection instance is truly optimal and maintains time complexity  
guarantees -- as might be the case if collections types were interfaces  
which could have been implemented anywhere -- then they may feel  
compelled to write defensive code. By locking the implementations down,  
developers can rely on the behavior of a given collection type.
\ No newline at end of file

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



[gwt-contrib] Comment on LightweightCollections in google-web-toolkit

2009-06-23 Thread codesite-noreply

Comment by cromwellian:

In cases where a concrete collection models a non-sparse non-immutable  
random-access list backed by a native array, we can potentially preserve  
Java for-each by using the reinterpretCast trick to return a native array  
E[] since for-each works for both arrays and Iterable.  In the immutable  
case, you can't use it due to the ability to poke around in the array.

Another potential idea is to support internal iterator ala Scala, by having  
an each() method that takes a callback. This avoids the need to have  
for-each or Iterator objects and allows the collection to implement the  
iteration over its elements in the best way possible. e.g.

lightweightArray.each(new Closure() {
   public void f(String element, int index) {
  // do something
   }
});

Since we're talking Scala, we can also add support for map, filter, and  
reduce. :)



For more information:
http://code.google.com/p/google-web-toolkit/wiki/LightweightCollections

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



[gwt-contrib] Comment on AdvancedCompilerOptimizations in google-web-toolkit

2009-06-23 Thread codesite-noreply

Comment by cromwellian:

Are there any other reserved properties besides 'prototype', 'constructor',  
and '__proto__'? I'm wondering what the performance impact would be of  
using a static regular expression to check during a put() operation. Reads  
tend to be higher than writes for maps, so it could be a win. The  
alternative is prefixing, which seems worse since it invariably created  
another object.

On the intrinsic front, I think that is a good idea. I once submitted a  
patch to DeadCodeElimination that included a registry class where anyone  
could plugin intrinsic evaluation in a white-list. By default, it added  
stuff like intrinsics for all of java.lang.Math, and some classes like  
java.lang.Character, etc, but it was limited to cases where every parameter  
is a JLiteral.  What you're proposing is akin to a LISP macro. :)



For more information:
http://code.google.com/p/google-web-toolkit/wiki/AdvancedCompilerOptimizations

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



[gwt-contrib] Re: Changes hosted.html to unescape the gwt.hosted URI component.

2009-06-23 Thread Joel Webber
I have to agree with Evan's interpretation, to the extent that this spec
makes much sense at all. And google.com's behavior
is as good an arbiter as any. I'm going to go back to splitting on the ''
and move the decodeURIComponent() back
to the sub-component (i.e. our gwt.hosted=...). If anyone runs into a
real-world case where this causes a problem, file a bug and send it to
me.

On Mon, Jun 22, 2009 at 7:52 PM, Evan Adams e...@google.com wrote:

 An experiment with google.com shows that it does not work correctly with
 an  that is encoded.  I tried these two URLs that differ only with the
 treatment of the :

- http://www.google.com/search?hl=enas_q=digital+cameras
- http://www.google.com/search?hl=en%26as_q=digital+cameras

 Note, this is consistent with section 2.2 
 ofhttp://www.ietf.org/rfc/rfc3986.txt
 :

 *URIs that differ in the replacement of a reserved character with 
 its**corresponding percent-encoded octet are not equivalent.
 *

 so, I'll argue that  is not allowed to be encoded which, I believe is
 consistent with this in section 2.4:

 *producing a URI is when an implementation determines which of the
 reserved characters are to be used as subcomponent delimiters and which can
 be safely used as data.*


 I'm concluding that individual query parameters are considered subcomponents,
 so  is a delimiter and is never encoded.

 Therefore, I think you can safely break on the .

 Evan





 On Mon, Jun 22, 2009 at 2:58 PM, John Tamplin j...@google.com wrote:

 On Mon, Jun 22, 2009 at 5:26 PM, Evan Adams e...@google.com wrote:

 I considered this approach when responding in the bug report but ended up
 rejecting it.

 The problem is that it flattens the query parameter space.  Consider
 the case where one of the query params is a continue url that has it's own
 params.  They will be encoded and this distinguishes the original-URI's
 params from the continue-URI's params.  If you decode the whole query string
 that distinction is lost and you'll operate on the union of the two sets of
 params.

 So, if the continue-URI also has a gwt.hosted param, then you won't be
 able to distinguish the two.

 I think you need to break location.search into it's constituent params
 and then decode each of them separately.


 But how do you break it down if you don't decode it?  Since  is allowed
 to be encoded, that is ?a=bc=d should be considered equivalent to
 ?a=b%26c=d, how can you know how to break it up if you don't decode it?


 --
 John A. Tamplin
 Software Engineer (GWT), Google




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



[gwt-contrib] Re: Changes hosted.html to unescape the gwt.hosted URI component.

2009-06-23 Thread jgw

On 2009/06/22 22:50:38, jat wrote:
 LGTM pending resolution of Evan's comment in the GWTC thread.

 http://gwt-code-reviews.appspot.com/44801/diff/1002/8
 File dev/core/src/com/google/gwt/core/ext/linker/impl/hosted.html
(right):

 http://gwt-code-reviews.appspot.com/44801/diff/1002/8#newcode254
 Line 254: $hosted = $hosted;
 Why do we need this vacuous assignment?

Back and forth we go. After further discussion on gwtc, we decided that
it was more sensible to decode just the sub-component. It's extremely
hard to get a clear answer from the spec, so there's at least some
probability we're wrong here, but it appears to be correct for all real
use-cases we can think of.

http://gwt-code-reviews.appspot.com/44801

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



[gwt-contrib] Re: Changes hosted.html to unescape the gwt.hosted URI component.

2009-06-23 Thread jgw

On 2009/06/23 13:07:18, jgw wrote:
 On 2009/06/22 22:50:38, jat wrote:
  LGTM pending resolution of Evan's comment in the GWTC thread.
 
  http://gwt-code-reviews.appspot.com/44801/diff/1002/8
  File dev/core/src/com/google/gwt/core/ext/linker/impl/hosted.html
(right):
 
  http://gwt-code-reviews.appspot.com/44801/diff/1002/8#newcode254
  Line 254: $hosted = $hosted;
  Why do we need this vacuous assignment?

 Back and forth we go. After further discussion on gwtc, we decided
that it was
 more sensible to decode just the sub-component. It's extremely hard to
get a
 clear answer from the spec, so there's at least some probability we're
wrong
 here, but it appears to be correct for all real use-cases we can think
of.

Committed as r5605.

http://gwt-code-reviews.appspot.com/44801

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



[gwt-contrib] Adding ugly hack to allow developers to optionally disable history #hash setting on IE6.

2009-06-23 Thread jgw

Reviewers: bobv,

Message:
 From IM:
  Bob: Why can't you put the public method on HistoryImplIE6?
  Joel: Because it's package-protected.
  Bob: Oh I see.


http://gwt-code-reviews.appspot.com/44804/diff/1/3
File user/src/com/google/gwt/user/client/impl/HistoryImplIE6.java
(right):

http://gwt-code-reviews.appspot.com/44804/diff/1/3#newcode28
Line 28: private boolean updateHash = true;
 From Bob: Remove unused field.



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

Affected files:
   M user/src/com/google/gwt/user/client/impl/HistoryImpl.java
   M user/src/com/google/gwt/user/client/impl/HistoryImplIE6.java


Index: user/src/com/google/gwt/user/client/impl/HistoryImpl.java
===
--- user/src/com/google/gwt/user/client/impl/HistoryImpl.java   (revision  
5594)
+++ user/src/com/google/gwt/user/client/impl/HistoryImpl.java   (working copy)
@@ -38,6 +38,18 @@
  public class HistoryImpl implements HasValueChangeHandlersString,
  HasHandlers {

+  static boolean updateHashOnIE6 = true;
+
+  /**
+   * Sets whether the IE6 history implementation will update the URL hash  
when
+   * creating a new item. This should be used only for applications with  
large
+   * DOM structures that are suffering from performance problems when  
creating
+   * a new history item on IE6 and 7.
+   */
+  public static void setUpdateHashOnIE6(boolean updateHash) {
+HistoryImpl.updateHashOnIE6 = updateHash;
+  }
+
public static native String getToken() /*-{
  return $wnd.__gwt_historyToken || ;
}-*/;
Index: user/src/com/google/gwt/user/client/impl/HistoryImplIE6.java
===
--- user/src/com/google/gwt/user/client/impl/HistoryImplIE6.java
(revision  
5594)
+++ user/src/com/google/gwt/user/client/impl/HistoryImplIE6.java
(working  
copy)
@@ -25,6 +25,8 @@
   */
  class HistoryImplIE6 extends HistoryImpl {

+  private boolean updateHash = true;
+
/**
 * Sanitizes an untrusted string to be used in an HTML context. NOTE:  
This
 * method of escaping strings should only be used on Internet Explorer.
@@ -167,7 +169,7 @@
// if someone entered or linked to a bad url.
 
historyimplr...@com.google.gwt.user.client.impl.historyimplie6::reloadWindow()();
  }
-
+
  var historyToken =  
@com.google.gwt.user.client.impl.HistoryImpl::getToken()();
  if (historyToken  (token != historyToken)) {
 
historyimplr...@com.google.gwt.user.client.impl.historyimplie6::reloadWindow()();
@@ -199,7 +201,13 @@
  Location.reload();
}

-  private native void updateHash(String token) /*-{
+  private void updateHash(String token) {
+if (HistoryImpl.updateHashOnIE6) {
+  updateHashInternal(token);
+}
+  }
+
+  private native void updateHashInternal(String token) /*-{
  $wnd.location.hash =  
th...@com.google.gwt.user.client.impl.historyimpl::encodeFragment(Ljava/lang/String;)(token);
}-*/;
  }



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



[gwt-contrib] Comment on AdvancedCompilerOptimizations in google-web-toolkit

2009-06-23 Thread codesite-noreply

Comment by jat+awco...@google.com:

`__proto__` and `watch` were issues, and `toString` caused problems on some  
browsers if you ever tried to convert the map object to a string.  If I  
remember correctly, `__proto__` was the one that there was no way around.   
However, you still need the `hasOwnProperty` check on reading, since you  
will pick up a bunch of keys that aren't actually in the object and that  
set will change over time with new browsers.

What I had in mind was something like this (in String.java in our JRE emul):
{{{
   @GenerateWith(...StringFormatGenerator)
   public static String format(String format, Object... args) {
 // default implementation for all runtime values
   }
}}}

And `StringFormatGenerator` would get the AST for the call (or perhaps a  
generic version to isolate it from compiler internals) so it had the  
class/method it was generating and full expressions for the arguments, and  
it could either generate an AST to replace the call with or allow the call  
to be processed normally.

For this to be useful, the AST would probably need to have JSNI pulled up  
into the main AST so you could generate JS constructs directly, such as  
inlining JS regex objects from `java.util.regex.Pattern` usage.  Mapping  
the regexes would also need information across multiple calls, so probably  
the generator would need to get called at points during the evaluation of a  
method so it can keep track of them.



For more information:
http://code.google.com/p/google-web-toolkit/wiki/AdvancedCompilerOptimizations

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



[gwt-contrib] Comment on LightweightCollections in google-web-toolkit

2009-06-23 Thread codesite-noreply

Comment by tamplinjohn:

You could return the array in the immutable case if the compiler knew it  
wasn't going to get modified in this particular case.  Taking the idea from  
the other thread, the default implementation could be the safe one and a  
method call generator could generate a faster implementation when told by  
the compiler the result was only used in a read-only manner.

The downside of internal iterators are that you waste space in the object  
for its lifetime (even if it is a number of null references), and you can't  
have multiple iterators in progress on the same object at once.  In your  
example, if f called something that wanted to iterate on lightweightArray,  
it can't (or if it does, internally it has to be creating essentially an  
external iterator plus the extra overhead to keep track of them rather than  
letting callers manage them).  Additionally, you are creating an object for  
the callback (though the compiler might be able to remove the object  
allocation if it were smarter than it is today) so it isn't clear where the  
win is.


For more information:
http://code.google.com/p/google-web-toolkit/wiki/LightweightCollections

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



[gwt-contrib] checkstyle rule tweak

2009-06-23 Thread Freeland Abbott
Previously, it failed in the checkstyle rule, and didn't even reach the
helpfully explanatory echo.  This changes the echo to a fail, and
delays failure a bit, so that we only get the output if there is an error,
but we do get it.

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

Index: common.ant.xml
===
--- common.ant.xml	(revision 5608)
+++ common.ant.xml	(working copy)
@@ -275,12 +275,12 @@
 element name=sourcepath implicit=yes optional=true /
 sequential
   taskdef resource=checkstyletask.properties classpath=${gwt.tools.antlib}/checkstyle-all-4.2.jar;${gwt.build.lib}/gwt-customchecks.jar /
-  checkstyle config=${gwt.root}/eclipse/settings/code-style/gwt-checkstyle.xml maxErrors=0
+  checkstyle config=${gwt.root}/eclipse/settings/code-style/gwt-checkstyle.xml maxErrors=0 failOnViolation=false failureProperty=gwt.checkstyle.failed
   	formatter type=xml toFile=${project.build}/checkstyle_log.xml/
 property key=checkstyle.header.file file=${gwt.root}/eclipse/settings/code-style/google.header /
 sourcepath /
   /checkstyle
- echo message=Checkstyle messages are reported in checkstyle_log.xml located at ${project.build} /
+  fail message=Checkstyle errors exist, and are reported in checkstyle_log.xml located at ${project.build} if=gwt.checkstyle.failed /
 /sequential
   /macrodef
 


[gwt-contrib] gwt-servlet in eclipse

2009-06-23 Thread Cristiano

Hi all,
I've succesfully compiled GWT trunk by using Ant,
now I want to debug it inside eclipse.

I followed instructions on 
http://code.google.com/p/google-web-toolkit/source/browse/trunk/eclipse/README.txt,
with the exception that I'm using Eclipse 3.4 and I've left compiler
compliance level to 1.6.

I've been able to import the basic projects, but gwt-servlet show a
lot of errors (657) which seem to be related to missing classes in the
classpath
(UnableToCompleteException cannot be resolved to a type
RpcPolicyManifestLinker.javagwt-servlet/core/src/com/google/gwt/user/
linker/rpc, line 41
TreeLogger cannot be resolved to a type RpcPolicyManifestLinker.java
gwt-servlet/core/src/com/google/gwt/user/linker/rpc , line 40
...)
do anyone understand what's wrong? I suppose I misconfigured
something...

(to be clear, my intent is to try out oophm and to see if there are
any sign of UiBinder, but I'm usual to go into deep and to try to
understand what's happen in the underground)

thanks!
Cristiano


ps. I solved first issues in compiling with ant, mainly due to an old
version of Subversion in my system, which I have solved by installing
(= unzipping to a folder + adding the bin directory to the path)
subversion binaries from Tigris.org: Subversion Win32 binaries for
Apache 2.2.x - svn-win32-1.6.3.zip

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



[gwt-contrib] Yet more Data Binding and Validation Thoughts

2009-06-23 Thread Andrew Pietsch

Hi there,

Like many others I'm looking forward to see what you guys come up with
in the databinding area.  But I miss some of the PresentationModel/
ValueModel style frameworks I've come to like in Swing and thought I'd
put in my 2c worth on a basic approach/API that would make me a happy
customer.  Of course if you're planning something better then I can't
wait (c:

I originally posted this to the normal GWT group but the formatting
sucked so I've created a google document so I can use nice formatting
and such and the odd bit of color.

http://docs.google.com/View?id=dm73tfj_55dqrkpwgx

Any and all thoughts welcome.

Cheers
Andrew

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



[gwt-contrib] Re: i18n support for concrete default locale

2009-06-23 Thread Bruce Johnson
Apologies that I'm wy late to this party, but the whole template
search/replace thing doesn't seem ideal in that something like a typo in the
template name could cause some seriously hard-to-debug code.

Did you consider the case that if a property provider returns null, then the
fallback would get used? I like that idea because (1) it doesn't rely on
textual search/replace and (2) it seems like a good pattern to form the
basis of property provider chaining, which is a long-standing problem for
properties that get extended. That is, if a derived module extends a
property, it usually wants to also extend the property provider, which today
involves brittle copy/paste. It would be great to figure out some protocol
for calling each property provider -- most-derived to least -- such that the
first one that return non-null is taken to be the official answer, and
returning null means ask the next most derived provider for this same
property.

-- Bruce

On Mon, Jun 15, 2009 at 11:03 PM, Freeland Abbott fabb...@google.comwrote:

 Revision to the concept, for design review: See
 http://code.google.com/p/google-web-toolkit/wiki/DefaultLocaleBinding, but
 the short-and-sweet is:

- Introduction of XML tag set-property-fallback name=*propname*
value=*fallbackString*/.  It's fine, and expected, to set this zero,
one, or many times for any given property.
- A new field gets added in BindingProperty, with setter and getter,
and a default value of empty string
- getPropertyProvider() is rewritten to return, not the literal
property provider string, but the result of replacing all instances of
/*-FALLBACK-*/ with the fallback string, whether empty or otherwise.
- For my default locale use case, our I18N.gwt.xml sets the locale
fallback to default, and user code sets it to something real if the user
doesn't like that.


 On Wed, Jun 10, 2009 at 11:49 AM, Freeland Abbott fabb...@google.comwrote:

 Yes, he and I already discussed it.  I was initially trying to avoid
 needing a new XML tag when the existing one was such a near fit, but the
 legacy linker support issues convinced me we needed it.




 On Tue, Jun 9, 2009 at 5:37 PM, Bruce Johnson br...@google.com wrote:

 I like what jat said. Freeland?

 On Tue, Jun 9, 2009 at 5:33 PM, j...@google.com wrote:


 The alternative to this would be Bruce's suggestion of defining a
 specific fallback value for a selection property rather than using
 config properties for it.  That would narrow the scope to exactly what
 we know we want to support and simplify the linker changes and avoids
 the breaking API change for existing linkers (where they have to supply
 the config properties to avoid breaking, which means the same linker
 can't work for GWT 1.6 and GWT 2.0).

 Something like:
   set-property-fallback name=locale value=default/
 and the last set value wins.


 http://gwt-code-reviews.appspot.com/34832/diff/1/2
 File

 dev/core/src/com/google/gwt/core/ext/linker/impl/SelectionScriptLinker.java
 (right):

 http://gwt-code-reviews.appspot.com/34832/diff/1/2#newcode194
 Line 194: new TreeSetConfigurationProperty());
 It seems like allowing this could cause incorrect behavior.  I know it
 is a tradeoff of not breaking existing code, but if there is a linker
 which calls this method, any code depending on config property lookup
 will just break.

 http://gwt-code-reviews.appspot.com/34832/diff/1/2#newcode223
 Line 223: }
 It looks like we are just substituting the empty string for unknown
 properties, which is especially bad if the call is relayed through the
 above method.

 http://gwt-code-reviews.appspot.com/34832/diff/1/4
 File dev/core/src/com/google/gwt/dev/cfg/StaticPropertyOracle.java
 (right):

 http://gwt-code-reviews.appspot.com/34832/diff/1/4#newcode149
 Line 149: for (String v : prop.getAllowedValues()) {
 setValues.addAll(cprop.getAllowedValues())?

 Also, maybe this should be computed in getPossibleValues() instead.

 http://gwt-code-reviews.appspot.com/34832/diff/1/5
 File
 dev/core/src/com/google/gwt/dev/shell/ModuleSpacePropertyOracle.java
 (right):

 http://gwt-code-reviews.appspot.com/34832/diff/1/5#newcode127
 Line 127: for (String v : cprop.getAllowedValues()) {
 setValues.addAll(cprop.getAllowedValues())?

 Also, maybe this should be computed in getPossibleValues() instead.

 http://gwt-code-reviews.appspot.com/34832/diff/1/7
 File user/src/com/google/gwt/i18n/I18N.gwt.xml (right):

 http://gwt-code-reviews.appspot.com/34832/diff/1/7#newcode51
 Line 51: $wnd['__gwt_Locale'] = locale ||
 '/*-GWTCONFIGPROP(default.locale)-*/';
 I think we haven't nailed this down enough that we want anyone else
 using it and expecting it to keep working.  So, I would suggest a
 comment here to that effect.

 http://gwt-code-reviews.appspot.com/34832/diff/1/7#newcode55
 Line 55: return /*-GWTCONFIGPROP(default.locale)-*/;
 Since these can all be empty strings, I would suggest storing
 /*-GWTCONFIGPROP(default.locale)-*/ || 

[gwt-contrib] Re: naming runAsync calls

2009-06-23 Thread Lex Spoon

On Mon, Jun 22, 2009 at 7:33 PM, Ian Petersenispet...@gmail.com wrote:
 Here's what I mean:

   // ... surrounding code ...
   GWT.runAsync(new AsyncCallback() {
     public void onFailure(Throwable caught) {
       // deal with failure
     }

     @SplitPointName(I like Bruce's idea)
     public void onSuccess() {
       // deal with success
     }
   });
   // ... surrounding code ...

 I'm not sure if it's better or worse, but it seems more flexible than
 requiring a surrounding method.

Okay, call it proposal 5, annotation of onSuccess methods.

I'm not clear on how we should associate onSuccess methods with
runAsync calls in the general case.  Note that the argument to
runAsync doesn't currently have to be an anonymous inner class:

class Bakery {
  private static class CakeMaker implements RunAsyncCallback {...}
  public static void makeOrder(CakeType cake) {
GWT.runAsync(new CakeMaker(cake));
  }
}

It gets even more interesting if the CakeMaker type is abstract, and
the implementation is made by a builder class.  The builder might even
have multiple implementations:

class Bakery {
  private static abstract class CakeMaker implements RunAsyncCallback { }
  private static class CakeMakerBuilder {
...
public CakeMaker build() {
  class CakeMakerImpl1 extends CakeMaker {
public void onSuccess() { ... }
  }
  class CakeMakerImpl1() {
public void onSuccess() { ... }
  }
  if (someConfigProperty) { return new CakeMakerImpl1(); } else {
return new CakeMakerImpl2() }
}
  }
}


Which onSuccess method(s) should be annotated, and how should GWT
interpret those annotations?


Lex Spoon

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



[gwt-contrib] Re: i18n support for concrete default locale

2009-06-23 Thread Freeland Abbott
I like the general idea, yes.

A complication is that one of the changes John asked for, specific for the
i18n provider, was to return */*-FALLBACK-*/ || default*, with the idea
that a null/undefined fallback should be gracefully handled, since an
invalid locale return is going to break the generators.  I'm personally a
bit less concerned there (user both overrode the default and also
misconfigured = generator should test for and gracefully explain), but in
the i18n case we do have a fallback fallback to return, so I said okay.
That wouldn't work for chaining, first because you don't always have such a
fallback, and second because with a chain you couldn't put the fallback into
the provider, and having set-property-fallback-fallback / or
set-property-fallback exponent=n ... / is silly.



On Tue, Jun 23, 2009 at 11:35 AM, Bruce Johnson br...@google.com wrote:

 Apologies that I'm wy late to this party, but the whole template
 search/replace thing doesn't seem ideal in that something like a typo in the
 template name could cause some seriously hard-to-debug code.

 Did you consider the case that if a property provider returns null, then
 the fallback would get used? I like that idea because (1) it doesn't rely on
 textual search/replace and (2) it seems like a good pattern to form the
 basis of property provider chaining, which is a long-standing problem for
 properties that get extended. That is, if a derived module extends a
 property, it usually wants to also extend the property provider, which today
 involves brittle copy/paste. It would be great to figure out some protocol
 for calling each property provider -- most-derived to least -- such that the
 first one that return non-null is taken to be the official answer, and
 returning null means ask the next most derived provider for this same
 property.

 -- Bruce


 On Mon, Jun 15, 2009 at 11:03 PM, Freeland Abbott fabb...@google.comwrote:

 Revision to the concept, for design review: See
 http://code.google.com/p/google-web-toolkit/wiki/DefaultLocaleBinding,
 but the short-and-sweet is:

- Introduction of XML tag set-property-fallback name=*propname*
value=*fallbackString*/.  It's fine, and expected, to set this
zero, one, or many times for any given property.
- A new field gets added in BindingProperty, with setter and getter,
and a default value of empty string
- getPropertyProvider() is rewritten to return, not the literal
property provider string, but the result of replacing all instances of
/*-FALLBACK-*/ with the fallback string, whether empty or otherwise.
- For my default locale use case, our I18N.gwt.xml sets the locale
fallback to default, and user code sets it to something real if the user
doesn't like that.


 On Wed, Jun 10, 2009 at 11:49 AM, Freeland Abbott fabb...@google.comwrote:

 Yes, he and I already discussed it.  I was initially trying to avoid
 needing a new XML tag when the existing one was such a near fit, but the
 legacy linker support issues convinced me we needed it.




 On Tue, Jun 9, 2009 at 5:37 PM, Bruce Johnson br...@google.com wrote:

 I like what jat said. Freeland?

 On Tue, Jun 9, 2009 at 5:33 PM, j...@google.com wrote:


 The alternative to this would be Bruce's suggestion of defining a
 specific fallback value for a selection property rather than using
 config properties for it.  That would narrow the scope to exactly what
 we know we want to support and simplify the linker changes and avoids
 the breaking API change for existing linkers (where they have to supply
 the config properties to avoid breaking, which means the same linker
 can't work for GWT 1.6 and GWT 2.0).

 Something like:
   set-property-fallback name=locale value=default/
 and the last set value wins.


 http://gwt-code-reviews.appspot.com/34832/diff/1/2
 File

 dev/core/src/com/google/gwt/core/ext/linker/impl/SelectionScriptLinker.java
 (right):

 http://gwt-code-reviews.appspot.com/34832/diff/1/2#newcode194
 Line 194: new TreeSetConfigurationProperty());
 It seems like allowing this could cause incorrect behavior.  I know it
 is a tradeoff of not breaking existing code, but if there is a linker
 which calls this method, any code depending on config property lookup
 will just break.

 http://gwt-code-reviews.appspot.com/34832/diff/1/2#newcode223
 Line 223: }
 It looks like we are just substituting the empty string for unknown
 properties, which is especially bad if the call is relayed through the
 above method.

 http://gwt-code-reviews.appspot.com/34832/diff/1/4
 File dev/core/src/com/google/gwt/dev/cfg/StaticPropertyOracle.java
 (right):

 http://gwt-code-reviews.appspot.com/34832/diff/1/4#newcode149
 Line 149: for (String v : prop.getAllowedValues()) {
 setValues.addAll(cprop.getAllowedValues())?

 Also, maybe this should be computed in getPossibleValues() instead.

 http://gwt-code-reviews.appspot.com/34832/diff/1/5
 File
 dev/core/src/com/google/gwt/dev/shell/ModuleSpacePropertyOracle.java
 

[gwt-contrib] [google-web-toolkit commit] r5605 - Fixes hosted.html to decode the gwt.hosted part of the url.

2009-06-23 Thread codesite-noreply

Author: j...@google.com
Date: Tue Jun 23 06:05:16 2009
New Revision: 5605

Modified:
trunk/dev/core/src/com/google/gwt/core/ext/linker/impl/hosted.html

Log:
Fixes hosted.html to decode the gwt.hosted part of the url.
Review: http://gwt-code-reviews.appspot.com/44801


Modified: trunk/dev/core/src/com/google/gwt/core/ext/linker/impl/hosted.html
==
--- trunk/dev/core/src/com/google/gwt/core/ext/linker/impl/hosted.html   
(original)
+++ trunk/dev/core/src/com/google/gwt/core/ext/linker/impl/hosted.html  Tue  
Jun 23 06:05:16 2009
@@ -11,7 +11,7 @@
  // is removed, we can drop the window.location.search part of this logic.
  var moduleFuncName = window.location.search.substring(1);
  if (!moduleFuncName || !$wnd[moduleFuncName]) {
-   moduleFuncName = window.name;
+  moduleFuncName = window.name;
  }

  var moduleFunc = $wnd[moduleFuncName];
@@ -248,6 +248,10 @@
  } else {
$hosted = query.substring(idx + 11);
  }
+
+// According to RFC 3986, some of this component's characters  
(e.g., ':')
+// are reserved and *may* be escaped.
+$hosted = decodeURIComponent($hosted);
}
  }


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



[gwt-contrib] Re: checkstyle rule tweak

2009-06-23 Thread Eric Ayers

LGTM

On Tue, Jun 23, 2009 at 12:10 PM, Freeland Abbottfabb...@google.com wrote:
 Substitute with this version, having discovered structural errors with
 samples (${project.build} is lowercase, but output is uppercase) and some
 comments from Eric regarding the presubmit target (which are actually
 orthogonal, but since I'm here)



 On Tue, Jun 23, 2009 at 11:32 AM, Freeland Abbott fabb...@google.com
 wrote:

 Previously, it failed in the checkstyle rule, and didn't even reach the
 helpfully explanatory echo.  This changes the echo to a fail, and
 delays failure a bit, so that we only get the output if there is an error,
 but we do get it.






-- 
Eric Z. Ayers - GWT Team - Atlanta, GA USA
http://code.google.com/webtoolkit/

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



[gwt-contrib] [google-web-toolkit commit] r5607 - Merge r5606 from trunk into snapshot to pick up HistoryImplIE6 change to selectively disa...

2009-06-23 Thread codesite-noreply

Author: b...@google.com
Date: Tue Jun 23 06:59:40 2009
New Revision: 5607

Modified:
branches/snapshot-2009.06.16-r5570/   (props changed)
 
branches/snapshot-2009.06.16-r5570/dev/core/src/com/google/gwt/core/ext/ServletContainer.java

(props changed)
 
branches/snapshot-2009.06.16-r5570/dev/core/src/com/google/gwt/core/ext/ServletContainerLauncher.java

(props changed)
 
branches/snapshot-2009.06.16-r5570/dev/core/src/com/google/gwt/dev/shell/rewrite/RewriteSingleJsoImplDispatches.java

(props changed)
 
branches/snapshot-2009.06.16-r5570/dev/core/src/com/google/gwt/dev/util/arg/ArgHandlerDisableAggressiveOptimization.java

(props changed)
 
branches/snapshot-2009.06.16-r5570/dev/core/src/com/google/gwt/dev/util/arg/ArgHandlerEnableAssertions.java

(props changed)
 
branches/snapshot-2009.06.16-r5570/dev/core/src/com/google/gwt/dev/util/arg/ArgHandlerOutDir.java

(props changed)
 
branches/snapshot-2009.06.16-r5570/dev/core/src/com/google/gwt/dev/util/arg/ArgHandlerWorkDirOptional.java

(props changed)
 
branches/snapshot-2009.06.16-r5570/dev/core/src/com/google/gwt/dev/util/arg/ArgHandlerWorkDirRequired.java

(props changed)
 
branches/snapshot-2009.06.16-r5570/dev/core/test/com/google/gwt/dev/AboutTest.java

(props changed)
 
branches/snapshot-2009.06.16-r5570/distro-source/linux/src/webAppCreator
(props changed)
branches/snapshot-2009.06.16-r5570/distro-source/mac/src/webAppCreator
(props changed)
 
branches/snapshot-2009.06.16-r5570/distro-source/windows/src/webAppCreator.cmd  
  
(props changed)
 
branches/snapshot-2009.06.16-r5570/eclipse/samples/Hello/Hello-gwtc.launch
(props changed)
branches/snapshot-2009.06.16-r5570/samples/dynatable/war/DynaTable.css
(props changed)
 
branches/snapshot-2009.06.16-r5570/samples/dynatable/war/DynaTable.html
(props changed)
branches/snapshot-2009.06.16-r5570/samples/hello/war/Hello.html   (props  
changed)
branches/snapshot-2009.06.16-r5570/samples/i18n/war/I18N.css   (props  
changed)
branches/snapshot-2009.06.16-r5570/samples/i18n/war/I18N.html   (props  
changed)
branches/snapshot-2009.06.16-r5570/samples/json/war/JSON.css   (props  
changed)
branches/snapshot-2009.06.16-r5570/samples/json/war/JSON.html   (props  
changed)
branches/snapshot-2009.06.16-r5570/samples/mail/war/Mail.css   (props  
changed)
branches/snapshot-2009.06.16-r5570/samples/mail/war/Mail.html   (props  
changed)
branches/snapshot-2009.06.16-r5570/samples/mail/war/gradient.gif
(props changed)
branches/snapshot-2009.06.16-r5570/samples/mail/war/leftCorner.gif
(props changed)
branches/snapshot-2009.06.16-r5570/samples/mail/war/rightCorner.gif
(props changed)
branches/snapshot-2009.06.16-r5570/samples/showcase/war/Showcase.html
(props changed)
branches/snapshot-2009.06.16-r5570/samples/simplerpc/war/SimpleRPC.css
(props changed)
 
branches/snapshot-2009.06.16-r5570/samples/simplerpc/war/SimpleRPC.html
(props changed)
branches/snapshot-2009.06.16-r5570/samples/simplexml/war/SimpleXML.css
(props changed)
 
branches/snapshot-2009.06.16-r5570/samples/simplexml/war/SimpleXML.html
(props changed)
 
branches/snapshot-2009.06.16-r5570/user/src/com/google/gwt/core/client/HttpThrowableReporter.java

(props changed)
 
branches/snapshot-2009.06.16-r5570/user/src/com/google/gwt/core/client/JsonUtils.java

(props changed)
 
branches/snapshot-2009.06.16-r5570/user/src/com/google/gwt/event/dom/client/HandlesAllFocusEvents.java

(props changed)
 
branches/snapshot-2009.06.16-r5570/user/src/com/google/gwt/event/dom/client/HandlesAllKeyEvents.java

(props changed)
 
branches/snapshot-2009.06.16-r5570/user/src/com/google/gwt/event/dom/client/HandlesAllMouseEvents.java

(props changed)
 
branches/snapshot-2009.06.16-r5570/user/src/com/google/gwt/event/dom/client/KeyCodes.java

(props changed)
 
branches/snapshot-2009.06.16-r5570/user/src/com/google/gwt/event/dom/client/PrivateMap.java

(props changed)
 
branches/snapshot-2009.06.16-r5570/user/src/com/google/gwt/event/logical/shared/HasValueChangeHandlers.java

(props changed)
 
branches/snapshot-2009.06.16-r5570/user/src/com/google/gwt/event/logical/shared/ValueChangeEvent.java

(props changed)
 
branches/snapshot-2009.06.16-r5570/user/src/com/google/gwt/event/logical/shared/ValueChangeHandler.java

(props changed)
 
branches/snapshot-2009.06.16-r5570/user/src/com/google/gwt/event/shared/DefaultHandlerRegistration.java

(props changed)
 
branches/snapshot-2009.06.16-r5570/user/src/com/google/gwt/event/shared/GwtEvent.java

(props changed)
 
branches/snapshot-2009.06.16-r5570/user/src/com/google/gwt/event/shared/HandlerRegistration.java

(props changed)
branches/snapshot-2009.06.16-r5570/user/src/com/google/gwt/resources/
(props changed)
 

[gwt-contrib] Re: checkstyle rule tweak

2009-06-23 Thread Freeland Abbott
Thanks.  Submitted at r5612.

On Tue, Jun 23, 2009 at 12:15 PM, Eric Ayers zun...@google.com wrote:

 LGTM

 On Tue, Jun 23, 2009 at 12:10 PM, Freeland Abbottfabb...@google.com
 wrote:
  Substitute with this version, having discovered structural errors with
  samples (${project.build} is lowercase, but output is uppercase) and some
  comments from Eric regarding the presubmit target (which are actually
  orthogonal, but since I'm here)
 
 
 
  On Tue, Jun 23, 2009 at 11:32 AM, Freeland Abbott fabb...@google.com
  wrote:
 
  Previously, it failed in the checkstyle rule, and didn't even reach
 the
  helpfully explanatory echo.  This changes the echo to a fail, and
  delays failure a bit, so that we only get the output if there is an
 error,
  but we do get it.
 
 
 



 --
 Eric Z. Ayers - GWT Team - Atlanta, GA USA
 http://code.google.com/webtoolkit/


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



[gwt-contrib] [google-web-toolkit commit] r5609 - Added first draft of Collections and Array types.

2009-06-23 Thread codesite-noreply

Author: br...@google.com
Date: Tue Jun 23 09:07:00 2009
New Revision: 5609

Modified:
wiki/LightweightCollections.wiki

Log:
Added first draft of Collections and Array types.

Modified: wiki/LightweightCollections.wiki
==
--- wiki/LightweightCollections.wiki(original)
+++ wiki/LightweightCollections.wikiTue Jun 23 09:07:00 2009
@@ -44,4 +44,73 @@

  _Publish and guarantee time complexity for various operations._

-_Keep implementations locked down._ Because it's very tricky to get the  
implementations for these sorts of collections just right, the plan is to  
minimize ways in which there could be confusion about the implementation of  
a given collection type. More concretely, the key types should be classes  
rather than interfaces so that their implementation can be restricted to  
the package in which they are defined. If developers cannot trust that a  
given collection instance is truly optimal and maintains time complexity  
guarantees -- as might be the case if collections types were interfaces  
which could have been implemented anywhere -- then they may feel  
compelled to write defensive code. By locking the implementations down,  
developers can rely on the behavior of a given collection type.
\ No newline at end of file
+_Keep implementations locked down._ Because it's very tricky to get the  
implementations for these sorts of collections just right, the plan is to  
minimize ways in which there could be confusion about the implementation of  
a given collection type. More concretely, the key types should be classes  
rather than interfaces so that their implementation can be restricted to  
the package in which they are defined. If developers cannot trust that a  
given collection instance is truly optimal and maintains time complexity  
guarantees -- as might be the case if collections types were interfaces  
which could have been implemented anywhere -- then they may feel  
compelled to write defensive code. By locking the implementations down,  
developers can rely on the behavior of a given collection type.
+
+=== Collections ===
+_Unfinished. Other collections, as they are fleshed out, will also be  
constructed via this class._
+
+{{{
+/**
+ * The single starting point for interacting with collections from scratch.
+ * All collection instances are originally obtained via a method in this  
class.
+ * Using a factory method rather than a constructor for, say,  
MutableArrayE
+ * provides convenient inference of the collection's generic type and also  
provides
+ * a way to satisfy the requirement that JSOs cannot have exposed  
constructors.
+ */
+public class Collections {
+  public E MutableArrayE createMutableArray();
+}
+}}}
+
+=== Array, MutableArray, and ImmutableArray ===
+
+{{{
+/**
+ * A root collection that provides a read-only interface to an array
+ * whose contents may or may not be mutable, making it possible to create  
read-only
+ * library algorithms that work with either mutable or immutable arrays  
without
+ * making calling code paranoid about whether the library routine might  
mutate it,
+ * thus preventing the desire to do defensive wrapping or copying.
+ */
+public class ArrayE {
+  @ConstantTime public E get(int index);
+  @ConstantTime public int size();
+}
+
+/**
+ * A mutable collection that is very similar to ArrayList
+ * (and C++ vector, and many others). It has the ability to efficiently
+ * freeze itself into an ImmutableArray.
+ */
+public class MutableArrayE extends ArrayE {
+  // Changes the element at a particular index
+  @ConstantTime public void set(int index, E elem);
+
+  // Appends an element to the end of the array
+  @ConstantTime public void add(E elem);
+
+  // Inserts an element into the specified index, lengthening the array by  
1
+  @LinearTime public void insert(int index, E elem);
+
+  // Removes the element at the specified index, shortening the array by 1
+  @LinearTime public void remove(int index);
+
+  // Removes all elements of the array
+  @ConstantTime public void clear();
+
+  // Creates an immutable array based on the state of this instance.
+  // The returned array may or may not have the same identity as this.
+  // After this call, this instance may no longer be used as a  
MutableArray instance
+  // (assertions double-check that no subsequent modifications are made).
+  @ConstantTime public ImmutableArrayE freeze();
+}
+
+/**
+ * An immutable collection that makes that iron-clad guarantee that code
+ * holding a reference to an instance can be certain that its
+ * contents will not change over time.
+ */
+public class ImmutableArrayE extends ArrayE {
+  // Only inherited members
+}
+}}}
\ No newline at end of file

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



[gwt-contrib] [google-web-toolkit commit] r5608 - Update branch-info.txt to record merge of r5606 from trunk.

2009-06-23 Thread codesite-noreply

Author: b...@google.com
Date: Tue Jun 23 07:58:04 2009
New Revision: 5608

Modified:
branches/snapshot-2009.06.16-r5570/branch-info.txt

Log:
Update branch-info.txt to record merge of r5606 from trunk.


Modified: branches/snapshot-2009.06.16-r5570/branch-info.txt
==
--- branches/snapshot-2009.06.16-r5570/branch-info.txt  (original)
+++ branches/snapshot-2009.06.16-r5570/branch-info.txt  Tue Jun 23 07:58:04  
2009
@@ -15,4 +15,6 @@
$ svn merge -c5590 https://google-web-toolkit.googlecode.com/svn/trunk
  /trunk 5597 was merged (r5598) into snapshot
$ svn merge -c5597 https://google-web-toolkit.googlecode.com/svn/trunk
+/trunk 5606 was merged (r5607) into snapshot
+  $ svn merge -c5606 https://google-web-toolkit.googlecode.com/svn/trunk


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



[gwt-contrib] [google-web-toolkit commit] r5610 - Checkstyle fixes. The error one is alphabetization in HistoryImpl.java;

2009-06-23 Thread codesite-noreply

Author: fabb...@google.com
Date: Tue Jun 23 09:12:15 2009
New Revision: 5610

Modified:
trunk/user/src/com/google/gwt/core/client/JavaScriptObject.java
trunk/user/src/com/google/gwt/i18n/client/TimeZone.java
trunk/user/src/com/google/gwt/i18n/server/GwtLocaleImpl.java
trunk/user/src/com/google/gwt/jsonp/client/JsonpRequest.java
trunk/user/src/com/google/gwt/user/client/impl/HistoryImpl.java

Log:
Checkstyle fixes.  The error one is alphabetization in HistoryImpl.java;
the rest are just periods in javadoc.



Modified: trunk/user/src/com/google/gwt/core/client/JavaScriptObject.java
==
--- trunk/user/src/com/google/gwt/core/client/JavaScriptObject.java  
(original)
+++ trunk/user/src/com/google/gwt/core/client/JavaScriptObject.java Tue Jun 
 
23 09:12:15 2009
@@ -141,7 +141,7 @@
}

/**
-   * Call the toSource() on the JSO
+   * Call the toSource() on the JSO.
 */
public native String toSource() /*-{
  this.toSource ? this.toSource() : NO SOURCE;

Modified: trunk/user/src/com/google/gwt/i18n/client/TimeZone.java
==
--- trunk/user/src/com/google/gwt/i18n/client/TimeZone.java (original)
+++ trunk/user/src/com/google/gwt/i18n/client/TimeZone.java Tue Jun 23  
09:12:15 2009
@@ -282,7 +282,7 @@

/**
 * Check whether the given date and time falls within a daylight savings  
time
-   * period
+   * period.
 *
 * @param date and time to check.
 * @return true if daylight savings time is in effect.

Modified: trunk/user/src/com/google/gwt/i18n/server/GwtLocaleImpl.java
==
--- trunk/user/src/com/google/gwt/i18n/server/GwtLocaleImpl.java
(original)
+++ trunk/user/src/com/google/gwt/i18n/server/GwtLocaleImpl.javaTue Jun 
23  
09:12:15 2009
@@ -337,10 +337,9 @@
}

/**
-   * Returns this locale in canonical form:
+   * Returns this locale in canonical form.  Changes for canonical form  
are:
 * ul
 *  liDeprecated language/region tags are replaced with official  
versions
-   *  li
 * /ul
 *
 * @return GwtLocale instance

Modified: trunk/user/src/com/google/gwt/jsonp/client/JsonpRequest.java
==
--- trunk/user/src/com/google/gwt/jsonp/client/JsonpRequest.java
(original)
+++ trunk/user/src/com/google/gwt/jsonp/client/JsonpRequest.javaTue Jun 
23  
09:12:15 2009
@@ -67,7 +67,7 @@
private final AsyncCallbackT callback;

/**
-   * Whether the result is expected to be an integer or not
+   * Whether the result is expected to be an integer or not.
 */
@SuppressWarnings(unused) // used by JSNI
private final boolean expectInteger;

Modified: trunk/user/src/com/google/gwt/user/client/impl/HistoryImpl.java
==
--- trunk/user/src/com/google/gwt/user/client/impl/HistoryImpl.java  
(original)
+++ trunk/user/src/com/google/gwt/user/client/impl/HistoryImpl.java Tue Jun 
 
23 09:12:15 2009
@@ -40,6 +40,10 @@

static boolean updateHashOnIE6 = true;

+  public static native String getToken() /*-{
+return $wnd.__gwt_historyToken || ;
+  }-*/;
+
/**
 * Sets whether the IE6 history implementation will update the URL hash  
when
 * creating a new item. This should be used only for applications with  
large
@@ -49,10 +53,6 @@
public static void setUpdateHashOnIE6(boolean updateHash) {
  HistoryImpl.updateHashOnIE6 = updateHash;
}
-
-  public static native String getToken() /*-{
-return $wnd.__gwt_historyToken || ;
-  }-*/;

protected static native void setToken(String token) /*-{
  $wnd.__gwt_historyToken = token;

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



[gwt-contrib] [google-web-toolkit commit] r5611 - Suppressed wiki words in headings, added a little example code for arrays.

2009-06-23 Thread codesite-noreply

Author: br...@google.com
Date: Tue Jun 23 09:18:01 2009
New Revision: 5611

Modified:
wiki/LightweightCollections.wiki

Log:
Suppressed wiki words in headings, added a little example code for arrays.

Modified: wiki/LightweightCollections.wiki
==
--- wiki/LightweightCollections.wiki(original)
+++ wiki/LightweightCollections.wikiTue Jun 23 09:18:01 2009
@@ -46,7 +46,7 @@

  _Keep implementations locked down._ Because it's very tricky to get the  
implementations for these sorts of collections just right, the plan is to  
minimize ways in which there could be confusion about the implementation of  
a given collection type. More concretely, the key types should be classes  
rather than interfaces so that their implementation can be restricted to  
the package in which they are defined. If developers cannot trust that a  
given collection instance is truly optimal and maintains time complexity  
guarantees -- as might be the case if collections types were interfaces  
which could have been implemented anywhere -- then they may feel  
compelled to write defensive code. By locking the implementations down,  
developers can rely on the behavior of a given collection type.

-=== Collections ===
+=== !Collections ===
  _Unfinished. Other collections, as they are fleshed out, will also be  
constructed via this class._

  {{{
@@ -62,7 +62,7 @@
  }
  }}}

-=== Array, MutableArray, and ImmutableArray ===
+=== Array, !MutableArray, and !ImmutableArray ===

  {{{
  /**
@@ -113,4 +113,42 @@
  public class ImmutableArrayE extends ArrayE {
// Only inherited members
  }
-}}}
\ No newline at end of file
+}}}
+
+
+== Examples of Intended Usage ==
+
+=== Arrays ===
+{{{
+public E void printEach(ArrayE arrToPrint) {
+  for (int i = 0, n = arrToPrint.size(); i  n; ++i) {
+Window.alert(arrToPrint.get(i).toString());
+  }
+}
+
+public MutableArrayString makeSnackArray() {
+  MutableArrayString a = createMutableArray();
+  a.add(apple);
+  a.add(banana);
+  a.add(coconut);
+  a.add(donut);
+  return a;
+}
+
+public void exampleOne() {
+  MutableArrayString a = makeSnackArray();
+  printEach(a);
+}
+
+public void exampleTwo() {
+  MutableArrayString ma = makeSnackArray();
+  ImmutableArrayString ia = ma.freeze();
+
+  // We can't touch 'ma' any more, but we can
+  // confidently hand out aliases all over the place.
+  new MyView1(ia).show();
+  new MyView2(ia).show();
+  new MyView3(ia).show();
+}
+}}}
+

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



[gwt-contrib] [google-web-toolkit commit] r5612 - Fixing the checkstyle and presubmit rules. Checkstyle never reached the

2009-06-23 Thread codesite-noreply

Author: fabb...@google.com
Date: Tue Jun 23 09:20:54 2009
New Revision: 5612

Modified:
trunk/build.xml
trunk/common.ant.xml
trunk/samples/common.ant.xml

Log:
Fixing the checkstyle and presubmit rules.  Checkstyle never reached the
where's the log? echo, so changed checkstyle to non-failing and the
echo to a fail ... if   Samples are in upper-case directories, but
${project.build} is lowercase, so allow checkstyle output directory to be
overrridden.  And jiggle the order of presubmit, to fail fast.

Review by: zundel



Modified: trunk/build.xml
==
--- trunk/build.xml (original)
+++ trunk/build.xml Tue Jun 23 09:20:54 2009
@@ -130,7 +130,7 @@
  delete dir=${gwt.build} /
/target

-  target name =presubmit description=[action] Runs  
checkstyle,apichecker, and all tests  
depends=test,apicheck-nobuild,checkstyle 
+  target name =presubmit description=[action] Runs  
checkstyle,apichecker, and all tests  
depends=dist-dev,apicheck-nobuild,checkstyle,test
/target

target name=apicheck-nobuild

Modified: trunk/common.ant.xml
==
--- trunk/common.ant.xml(original)
+++ trunk/common.ant.xmlTue Jun 23 09:20:54 2009
@@ -272,15 +272,16 @@
/macrodef

macrodef name=gwt.checkstyle
+attribute name=outputdirectory default=${project.build}/
  element name=sourcepath implicit=yes optional=true /
  sequential
taskdef resource=checkstyletask.properties  
classpath=${gwt.tools.antlib}/checkstyle-all-4.2.jar;${gwt.build.lib}/gwt-customchecks.jar
  
/
-  checkstyle  
config=${gwt.root}/eclipse/settings/code-style/gwt-checkstyle.xml  
maxErrors=0
-   formatter type=xml toFile=${project.build}/checkstyle_log.xml/
+  checkstyle  
config=${gwt.root}/eclipse/settings/code-style/gwt-checkstyle.xml  
maxErrors=0 failOnViolation=false  
failureProperty=gwt.checkstyle.failed
+   formatter type=xml  
toFile=@{outputdirectory}/checkstyle_log.xml/
  property key=checkstyle.header.file  
file=${gwt.root}/eclipse/settings/code-style/google.header /
  sourcepath /
/checkstyle
- echo message=Checkstyle messages are reported in checkstyle_log.xml  
located at ${project.build} /
+  fail message=Checkstyle errors exist, and are reported in  
checkstyle_log.xml located at @{outputdirectory}  
if=gwt.checkstyle.failed /
  /sequential
/macrodef


Modified: trunk/samples/common.ant.xml
==
--- trunk/samples/common.ant.xml(original)
+++ trunk/samples/common.ant.xmlTue Jun 23 09:20:54 2009
@@ -107,7 +107,7 @@
target name=build depends=source, compile, gwtc, scripts  
description=Build and package this project /

target name=checkstyle description=Static analysis of source
-gwt.checkstyle
+gwt.checkstyle outputdirectory=${sample.build}
fileset dir=src /
  /gwt.checkstyle
/target

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



[gwt-contrib] [google-web-toolkit commit] r5606 - Adds hack to HistoryImpl that allows #hash setting on IE6/7 to be disabled.

2009-06-23 Thread codesite-noreply

Author: j...@google.com
Date: Tue Jun 23 06:48:42 2009
New Revision: 5606

Modified:
trunk/user/src/com/google/gwt/user/client/impl/HistoryImpl.java
trunk/user/src/com/google/gwt/user/client/impl/HistoryImplIE6.java

Log:
Adds hack to HistoryImpl that allows #hash setting on IE6/7 to be disabled.
Review: http://gwt-code-reviews.appspot.com/44804


Modified: trunk/user/src/com/google/gwt/user/client/impl/HistoryImpl.java
==
--- trunk/user/src/com/google/gwt/user/client/impl/HistoryImpl.java  
(original)
+++ trunk/user/src/com/google/gwt/user/client/impl/HistoryImpl.java Tue Jun 
 
23 06:48:42 2009
@@ -38,6 +38,18 @@
  public class HistoryImpl implements HasValueChangeHandlersString,
  HasHandlers {

+  static boolean updateHashOnIE6 = true;
+
+  /**
+   * Sets whether the IE6 history implementation will update the URL hash  
when
+   * creating a new item. This should be used only for applications with  
large
+   * DOM structures that are suffering from performance problems when  
creating
+   * a new history item on IE6 and 7.
+   */
+  public static void setUpdateHashOnIE6(boolean updateHash) {
+HistoryImpl.updateHashOnIE6 = updateHash;
+  }
+
public static native String getToken() /*-{
  return $wnd.__gwt_historyToken || ;
}-*/;

Modified: trunk/user/src/com/google/gwt/user/client/impl/HistoryImplIE6.java
==
--- trunk/user/src/com/google/gwt/user/client/impl/HistoryImplIE6.java   
(original)
+++ trunk/user/src/com/google/gwt/user/client/impl/HistoryImplIE6.java  Tue  
Jun 23 06:48:42 2009
@@ -167,7 +167,7 @@
// if someone entered or linked to a bad url.
 
historyimplr...@com.google.gwt.user.client.impl.historyimplie6::reloadWindow()();
  }
-
+
  var historyToken =  
@com.google.gwt.user.client.impl.HistoryImpl::getToken()();
  if (historyToken  (token != historyToken)) {
 
historyimplr...@com.google.gwt.user.client.impl.historyimplie6::reloadWindow()();
@@ -199,7 +199,13 @@
  Location.reload();
}

-  private native void updateHash(String token) /*-{
+  private void updateHash(String token) {
+if (HistoryImpl.updateHashOnIE6) {
+  updateHashInternal(token);
+}
+  }
+
+  private native void updateHashInternal(String token) /*-{
  $wnd.location.hash =  
th...@com.google.gwt.user.client.impl.historyimpl::encodeFragment(Ljava/lang/String;)(token);
}-*/;
  }

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



[gwt-contrib] Re: i18n support for concrete default locale

2009-06-23 Thread Bruce Johnson
It couldn't have been that easy. Surely someone disagrees?

On Tue, Jun 23, 2009 at 11:57 AM, John Tamplin j...@google.com wrote:

 On Tue, Jun 23, 2009 at 11:52 AM, Freeland Abbott fabb...@google.comwrote:

 I like the general idea, yes.

 A complication is that one of the changes John asked for, specific for the
 i18n provider, was to return */*-FALLBACK-*/ || default*, with the idea
 that a null/undefined fallback should be gracefully handled, since an
 invalid locale return is going to break the generators.  I'm personally a
 bit less concerned there (user both overrode the default and also
 misconfigured = generator should test for and gracefully explain), but in
 the i18n case we do have a fallback fallback to return, so I said okay.
 That wouldn't work for chaining, first because you don't always have such a
 fallback, and second because with a chain you couldn't put the fallback into
 the provider, and having set-property-fallback-fallback / or
 set-property-fallback exponent=n ... / is silly.


 Maybe if null gets all the way beck to the top, just replace it with an
 empty string, and the i18n code should treat that equivalently to default
 (it already does in many places).

 --
 John A. Tamplin
 Software Engineer (GWT), Google


 


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



[gwt-contrib] Issue 427: TextArea#getCursorPos()/getSelectedText() broken in IE

2009-06-23 Thread jlabanca

Reviewers: jgw,

Description:
Summary:
=
In IE, TextArea#getCursorPos(), getSelectionLength(), and
getSelectedText() all return the wrong values, setSelectedText() selects
the wrong value.  This is all due to IEs handling of newline characters.


Description:

Most browsers convert \r\n to \n and treat it as a normal character.
However, IE uses \r\n (and converts \n to it) in a text area, and the
TextRange object treats \r\n as one character, which is not consistent
with normal string manipulation.  In addition, the TextRange object
trims trailing \r\n off the end of the current selection.  Due to these
errors, many of our calculations for selection are off.

This patch accounts for \r\n in all calculations.  When setting
selection, we offset based on the number of \r\n that occur within or
before the selection.  When getting the cursor position or selection
length, we use a hack to deal with trailing \r\n.

With this patch, the following is true (and wasn't before):
- setCursorPos() is consistent with getCursorPos() (unless you try to
set the position between a \r\n, which isn't possible and automatically
moves to the new line.
- getSelectedText() returns the exact selected text
- All methods are consistent with the equivalent string manipulation.
For example, the cursor position is the same as the equivalent index in
the return value of getText().


Testing:
===
I manually tested these changes on IE7 and IE8, and I added unit tests
that capture the bug in its various forms.


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

Affected files:
   user/src/com/google/gwt/user/client/ui/TextBoxBase.java
   user/src/com/google/gwt/user/client/ui/impl/TextBoxImplIE6.java
   user/test/com/google/gwt/user/client/ui/TextAreaTest.java



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



[gwt-contrib] Re: Issue 427: TextArea#getCursorPos()/getSelectedText() broken in IE

2009-06-23 Thread jgw

Wow. Just wow. You know an API design (referring to the text-range stuff
in IE) is messed up when you have to do this much to normalize it.

LGTM (If by good one means hideous but necessary).

http://gwt-code-reviews.appspot.com/47801

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



[gwt-contrib] [google-web-toolkit commit] r5613 - Fix how the launch URL is built to include the gwt.hosted parameter

2009-06-23 Thread codesite-noreply

Author: j...@google.com
Date: Tue Jun 23 12:43:56 2009
New Revision: 5613

Modified:
trunk/dev/oophm/src/com/google/gwt/dev/OophmHostedModeBase.java

Log:
Fix how the launch URL is built to include the gwt.hosted parameter
(previously it would build it improperly if the launch URL had a
fragment).

Patch by: jat
Review by: jgw (desk)


Modified: trunk/dev/oophm/src/com/google/gwt/dev/OophmHostedModeBase.java
==
--- trunk/dev/oophm/src/com/google/gwt/dev/OophmHostedModeBase.java  
(original)
+++ trunk/dev/oophm/src/com/google/gwt/dev/OophmHostedModeBase.java Tue Jun 
 
23 12:43:56 2009
@@ -36,6 +36,7 @@
  import java.awt.event.WindowEvent;
  import java.io.IOException;
  import java.io.PrintWriter;
+import java.net.MalformedURLException;
  import java.net.URL;
  import java.util.IdentityHashMap;
  import java.util.Map;
@@ -294,13 +295,27 @@
   * TODO(jat): properly support launching arbitrary browsers; waiting on
   * Freeland's work with BrowserScanner and the trunk merge to get it.
   */
-String separator;
-if (url.contains(?)) {
-  separator = ;
-} else {
-  separator = ?;
+try {
+  URL parsedUrl = new URL(url);
+  String path = parsedUrl.getPath();
+  String query = parsedUrl.getQuery();
+  String hash = parsedUrl.getRef();
+  String hostedParam =  gwt.hosted= +  
listener.getEndpointIdentifier();
+  if (query == null) {
+query = hostedParam;
+  } else {
+query += '' + hostedParam;
+  }
+  path += '?' + query;
+  if (hash != null) {
+path += '#' + hash;
+  }
+  url = new URL(parsedUrl.getProtocol(), parsedUrl.getHost(),
+  parsedUrl.getPort(), path).toExternalForm();
+} catch (MalformedURLException e) {
+  getTopLogger().log(TreeLogger.ERROR, Invalid URL  + url, e);
+  throw new UnableToCompleteException();
  }
-url += separator + gwt.hosted= + listener.getEndpointIdentifier();
  TreeLogger branch = getTopLogger().branch(TreeLogger.INFO,
  Launching firefox with  + url, null);
  try {

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



[gwt-contrib] [google-web-toolkit commit] r5614 - Fix generic type handling in another case where the signature omits the

2009-06-23 Thread codesite-noreply

Author: j...@google.com
Date: Tue Jun 23 12:53:37 2009
New Revision: 5614

Modified:
 
changes/jat/ihm/dev/core/src/com/google/gwt/core/ext/typeinfo/JParameterizedType.java
 
changes/jat/ihm/dev/core/src/com/google/gwt/dev/javac/JavaBinaryOracleImpl.java
 
changes/jat/ihm/dev/core/src/com/google/gwt/dev/javac/asm/ResolveParameterizedType.java

Log:
Fix generic type handling in another case where the signature omits the
type parameter, handle the case where there are no binary resources found.


Modified:  
changes/jat/ihm/dev/core/src/com/google/gwt/core/ext/typeinfo/JParameterizedType.java
==
---  
changes/jat/ihm/dev/core/src/com/google/gwt/core/ext/typeinfo/JParameterizedType.java

(original)
+++  
changes/jat/ihm/dev/core/src/com/google/gwt/core/ext/typeinfo/JParameterizedType.java

Tue Jun 23 12:53:37 2009
@@ -99,7 +99,8 @@
  });

  this.typeArgs = Lists.create(typeArgs);
-assert (this.typeArgs.indexOf(null) == -1);
+assert (this.typeArgs.indexOf(null) == -1)
+: Unresolved typeArg creating JParameterizedType from  +  
baseType;

  // NOTE: Can't perform substitutions until we are done building
}

Modified:  
changes/jat/ihm/dev/core/src/com/google/gwt/dev/javac/JavaBinaryOracleImpl.java
==
---  
changes/jat/ihm/dev/core/src/com/google/gwt/dev/javac/JavaBinaryOracleImpl.java 
 
(original)
+++  
changes/jat/ihm/dev/core/src/com/google/gwt/dev/javac/JavaBinaryOracleImpl.java 
 
Tue Jun 23 12:53:37 2009
@@ -248,9 +248,9 @@
private MapString, JavaBinary binaryMap = new HashMapString,  
JavaBinary();
private SetString classNames = new HashSetString();

-  private SetJavaBinary exposedBinaries;
-  private MapString, JavaBinary exposedBinaryMap;
-  private SetString exposedClassNames;
+  private SetJavaBinary exposedBinaries = Collections.emptySet();
+  private MapString, JavaBinary exposedBinaryMap =  
Collections.emptyMap();
+  private SetString exposedClassNames = Collections.emptySet();

private SetResource cachedResources = Collections.emptySet();


Modified:  
changes/jat/ihm/dev/core/src/com/google/gwt/dev/javac/asm/ResolveParameterizedType.java
==
---  
changes/jat/ihm/dev/core/src/com/google/gwt/dev/javac/asm/ResolveParameterizedType.java
  
(original)
+++  
changes/jat/ihm/dev/core/src/com/google/gwt/dev/javac/asm/ResolveParameterizedType.java
  
Tue Jun 23 12:53:37 2009
@@ -199,7 +199,8 @@
  JGenericType genericType = type.isGenericType();
  if (genericType != null) {
int actual = typeArgs.length;
-  int expected = genericType.getTypeParameters().length;
+  JTypeParameter[] typeParams = genericType.getTypeParameters();
+  int expected = typeParams.length;
if (actual == 0  expected  0) {
  // If no type parameters were supplied, this is a raw type usage.
  type = genericType.getRawType();
@@ -226,11 +227,25 @@
JClassType[] outerArgs = null;
JGenericType genericEncGeneric = genericEnc.isGenericType();
if (genericEncGeneric != null) {
-JTypeParameter[] typeParams =  
genericEncGeneric.getTypeParameters();
-int n = typeParams.length;
+JTypeParameter[] encTypeParams =  
genericEncGeneric.getTypeParameters();
+int n = encTypeParams.length;
  outerArgs = new JClassType[n];
  for (int i = 0; i  n; ++i) {
-  outerArgs[i] = lookup.lookup(typeParams[i].getName());
+  outerArgs[i] = lookup.lookup(encTypeParams[i].getName());
+  if (outerArgs[i] == null) {
+// check to see if our current type has a parameter of the  
same
+// name, and use it if so.
+for (int j = 0; j  expected; ++j) {
+  if  
(typeParams[j].getName().equals(encTypeParams[j].getName())) {
+outerArgs[i] = typeArgs[j];
+break;
+  }
+}
+  }
+  assert outerArgs[i] != null
+  : Unable to resolve type parameter 
++ encTypeParams[i].getName() +  in enclosing type 
++ genericEnc +  of type  + genericType;
  }
}
outer = (JClassType) resolveGeneric(genericEnc, null, outerArgs);

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



[gwt-contrib] [google-web-toolkit commit] r5615 - Fixes a bunch of IE bugs in TextArea related to weird handling of newline characters.

2009-06-23 Thread codesite-noreply

Author: jlaba...@google.com
Date: Tue Jun 23 13:30:29 2009
New Revision: 5615

Modified:
trunk/user/src/com/google/gwt/user/client/ui/TextBoxBase.java
trunk/user/src/com/google/gwt/user/client/ui/impl/TextBoxImplIE6.java
trunk/user/test/com/google/gwt/user/client/ui/TextAreaTest.java

Log:
Fixes a bunch of IE bugs in TextArea related to weird handling of newline  
characters.

Patch by: jlabanca
Review by: jgw
Issue: 427



Modified: trunk/user/src/com/google/gwt/user/client/ui/TextBoxBase.java
==
--- trunk/user/src/com/google/gwt/user/client/ui/TextBoxBase.java   
(original)
+++ trunk/user/src/com/google/gwt/user/client/ui/TextBoxBase.java   Tue Jun 
 
23 13:30:29 2009
@@ -294,6 +294,15 @@
  impl.setSelectionRange(getElement(), pos, length);
}

+  /**
+   * Sets this object's text.  Note that some browsers will manipulate the  
text
+   * before adding it to the widget.  For example, most browsers will  
strip all
+   * code\r/code from the text, except IE which will add a  
code\r/code
+   * before each code\n/code.  Use {...@link #getText()} to get the text
+   * directly from the widget.
+   *
+   * @param text the object's new text
+   */
public void setText(String text) {
  DOM.setElementProperty(getElement(), value, text != null ?  
text : );
}

Modified:  
trunk/user/src/com/google/gwt/user/client/ui/impl/TextBoxImplIE6.java
==
--- trunk/user/src/com/google/gwt/user/client/ui/impl/TextBoxImplIE6.java   
 
(original)
+++ trunk/user/src/com/google/gwt/user/client/ui/impl/TextBoxImplIE6.java   
 
Tue Jun 23 13:30:29 2009
@@ -42,31 +42,75 @@
var tr = elem.document.selection.createRange();
if (tr.parentElement() !== elem)
  return 0;
-  return tr.text.length;
+  var trLength = tr.text.length;
+
+  // Subtract characters from the end to account for trimmed newlines.
+  var offset = 0;
+  var tr2 = tr.duplicate();
+  tr2.moveEnd('character', -1);
+  var tr2Length = tr2.text.length;
+  while (tr2Length == trLength  tr2.parentElement() == elem   
tr.compareEndPoints('StartToEnd', tr2) = 0) {
+offset += 2;
+tr2.moveEnd('character', -1);
+tr2Length = tr2.text.length;
+  }
+  return trLength + offset;
  }
  catch (e) {
return 0;
  }
}-*/;

+  /**
+   * The text reported in the text range does not include newline  
characters at
+   * the end of the selection. So, we need to create 2 ranges and subtract  
a
+   * character from one until the lengths are different. At that point, we  
know
+   * exactly how many \r\n were truncated from the selection.
+   */
@Override
public native int getTextAreaCursorPos(Element elem) /*-{
  try {
var tr = elem.document.selection.createRange();
+  if (tr.parentElement() !== elem)
+return -1;
var tr2 = tr.duplicate();
tr2.moveToElementText(elem);
-  tr.setEndPoint('EndToStart', tr2);
-  return tr.text.length;
+  tr2.setEndPoint('EndToStart', tr);
+  var tr2Length = tr2.text.length;
+
+  // Subtract characters from the end to account for trimmed newlines.
+  var offset = 0;
+  var tr3 = tr2.duplicate();
+  tr3.moveEnd('character', -1);
+  var tr3Length = tr3.text.length;
+  while (tr3Length == tr2Length  tr3.parentElement() == elem) {
+offset += 2;
+tr3.moveEnd('character', -1);
+tr3Length = tr3.text.length;
+  }
+  return tr2Length + offset;
  }
  catch (e) {
return 0;
  }
}-*/;

+  /**
+   * Moving the start 1 character will move across a \r\n, but \r\n counts  
as
+   * two characters, so we need to offset the position accordingly.
+   */
@Override
public native void setSelectionRange(Element elem, int pos, int length)  
/*-{
  try {
var tr = elem.createTextRange();
+  var newlinesWithin = elem.value.substr(pos,  
length).match(/(\r\n)/gi);
+  if (newlinesWithin != null) {
+length -= newlinesWithin.length;
+  }
+  var newlinesBefore = elem.value.substring(0, pos).match(/(\r\n)/gi);
+  if (newlinesBefore != null) {
+pos -= newlinesBefore.length;
+  }
tr.collapse(true);
tr.moveStart('character', pos);
tr.moveEnd('character', length);

Modified: trunk/user/test/com/google/gwt/user/client/ui/TextAreaTest.java
==
--- trunk/user/test/com/google/gwt/user/client/ui/TextAreaTest.java  
(original)
+++ trunk/user/test/com/google/gwt/user/client/ui/TextAreaTest.java Tue Jun 
 
23 13:30:29 2009
@@ -21,9 +21,50 @@
   */
  public class TextAreaTest extends TextBoxBaseTestBase {

+  /**
+   * Most browsers strip \r from newlines, but IE adds them in. IE's  
TextRange
+   * also 

[gwt-contrib] Comment on UsingOOPHM in google-web-toolkit

2009-06-23 Thread codesite-noreply

Comment by benzheren:

yah, I just remove it from the Eclipse launch config.


For more information:
http://code.google.com/p/google-web-toolkit/wiki/UsingOOPHM

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



[gwt-contrib] Re: Issue 427: TextArea#getCursorPos()/getSelectedText() broken in IE

2009-06-23 Thread Ray Cromwell
I'm wondering how many hours/how much $$$ this cost Google to implement. :)
Just more evidence that a class action lawsuit is needed against Microsoft
to recover damages for lost time and money. :)

-Ray

On Tue, Jun 23, 2009 at 1:26 PM, j...@google.com wrote:


 Wow. Just wow. You know an API design (referring to the text-range stuff
 in IE) is messed up when you have to do this much to normalize it.

 LGTM (If by good one means hideous but necessary).

 http://gwt-code-reviews.appspot.com/47801

 


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



[gwt-contrib] add support for deprecated currencies in CurrencyList

2009-06-23 Thread jat

Reviewers: andreasst,

Description:
This patch adds support for looking up deprecated currencies and a
special iterator to include them in the iteration, so it won't affect
existing code.

There will be a small size penalty as additional currency information
will be retained in the output script.

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

Affected files:
   user/src/com/google/gwt/i18n/client/impl/CurrencyData.java
   user/src/com/google/gwt/i18n/client/impl/CurrencyList.java
   user/src/com/google/gwt/i18n/rebind/CurrencyListGenerator.java
   user/test/com/google/gwt/i18n/I18NSuite.java
   user/test/com/google/gwt/i18n/client/NumberFormat_en_Test.java
   user/test/com/google/gwt/i18n/client/impl/CurrencyTest.java



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



[gwt-contrib] GWTTestCase/JUnit tweak to make mixing TestCase and GWTTestCase easier

2009-06-23 Thread bruce

Reviewers: scottb, amitmanjhi,

Description:
This patch treats any GWTTestCase-derived classes that return 'null'
from getModuleName() as if they were simply pure Java tests.

Why does this matter? Suppose you're writing tests for code that has
both a pure Java implementation and a super-sourced version of the same
types. Naturally, you want to re-use the same tests for both
implementations. With this patch, you can have the common tests extend
GWTTestCase but return 'null' from getModuleName(), thus causing the
pure Java version of the code to be tested. Then you can create a
subclass that actually does return a module name, which causes the same
tests to run in a proper GWT environment.


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

Affected files:
   user/src/com/google/gwt/junit/client/GWTTestCase.java
   user/src/com/google/gwt/junit/tools/GWTTestSuite.java



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



[gwt-contrib] Re: GWTTestCase/JUnit tweak to make mixing TestCase and GWTTestCase easier

2009-06-23 Thread scottb

LGTM with comments.


http://gwt-code-reviews.appspot.com/47804/diff/1/3
File user/src/com/google/gwt/junit/client/GWTTestCase.java (right):

http://gwt-code-reviews.appspot.com/47804/diff/1/3#newcode52
Line 52: * {...@link UnsupportedOperationException}.Instead, override
{...@link #gwtSetUp()}
While you're here, the existing comment was missing a space after the
end of the previous sentence.  But it would probably be best to commit
formatting-only changes separately to avoid confusing the semantic
change.

http://gwt-code-reviews.appspot.com/47804/diff/1/3#newcode229
Line 229: super.runTest();
Food for thought: consider setting up a default GWT.create() bridge
somehow?

http://gwt-code-reviews.appspot.com/47804

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



[gwt-contrib] Re: GWTTestCase/JUnit tweak to make mixing TestCase and GWTTestCase easier

2009-06-23 Thread amitmanjhi

LGTM with one inline comment and one design question Is it better to
have a special case handling of null or is it better to introduce a
default non-null value for this purpose?


http://gwt-code-reviews.appspot.com/47804/diff/1/3
File user/src/com/google/gwt/junit/client/GWTTestCase.java (right):

http://gwt-code-reviews.appspot.com/47804/diff/1/3#newcode122
Line 122: */
Update the javadoc with the null use case?

http://gwt-code-reviews.appspot.com/47804

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



[gwt-contrib] Re: GWTTestCase/JUnit tweak to make mixing TestCase and GWTTestCase easier

2009-06-23 Thread Bruce Johnson
Thanks, r5617.

On Tue, Jun 23, 2009 at 8:23 PM, amitman...@google.com wrote:

 LGTM with one inline comment and one design question Is it better to
 have a special case handling of null or is it better to introduce a
 default non-null value for this purpose?


 http://gwt-code-reviews.appspot.com/47804/diff/1/3
 File user/src/com/google/gwt/junit/client/GWTTestCase.java (right):

 http://gwt-code-reviews.appspot.com/47804/diff/1/3#newcode122
 Line 122: */
 Update the javadoc with the null use case?


 http://gwt-code-reviews.appspot.com/47804


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



[gwt-contrib] Comment on LightweightCollections in google-web-toolkit

2009-06-23 Thread codesite-noreply

Comment by rich...@zschech.net:

I had an idea how to reduce the code required for the immutable collections  
mutation methods throwing UnsupportedOperationException:

If the compiler detects that the bodies of two methods are the same then it  
can use the same JavaScript method.
For example in sudo Java/JavaScript code:

var throwUnsupportedOperationExceptionMethod = function() {
   throw new UnsupportedOperationException();
}
immutableCollection.add = throwUnsupportedOperationExceptionMethod;
immutableCollection.addAll = throwUnsupportedOperationExceptionMethod;
immutableCollection.clear = throwUnsupportedOperationExceptionMethod;
etc...

JavaScript does not care if the number of parameters the caller is using is  
different to what is defined. For example you can call with no issue:
immutableCollection.add(e);
immutableCollection.clear();

This could be generalised to reduce the size of any code although it would  
be time consuming to find methods with the same bodies.


For more information:
http://code.google.com/p/google-web-toolkit/wiki/LightweightCollections

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



[gwt-contrib] Comment on LightweightCollections in google-web-toolkit

2009-06-23 Thread codesite-noreply

Comment by rich...@zschech.net:

I had an idea how to reduce the code required for the immutable collections  
mutation methods throwing `UnsupportedOperationException`:

If the compiler detects that the bodies of two methods are the same then it  
can use the same Java Script method. For example in sudo Java / Java Script  
code:

`
var throwUnsupportedOperationExceptionMethod = function() {
 throw new UnsupportedOperationException?();
}
immutableCollection.add = throwUnsupportedOperationExceptionMethod;  
immutableCollection.addAll = throwUnsupportedOperationExceptionMethod;  
immutableCollection.clear = throwUnsupportedOperationExceptionMethod;
`
etc...

Java Script does not care if the number of parameters the caller is using  
is different to what is defined. For example you can call with no issue: `
`
immutableCollection.add(e);
immutableCollection.clear();
`

This could be generalised to reduce the size of any code although it would  
be time consuming to find methods with the same bodies.



For more information:
http://code.google.com/p/google-web-toolkit/wiki/LightweightCollections

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



[gwt-contrib] Comment on LightweightCollections in google-web-toolkit

2009-06-23 Thread codesite-noreply

Comment by rich...@zschech.net:

I had an idea how to reduce the code required for the immutable collections  
mutation methods throwing `UnsupportedOperationException`:

If the compiler detects that the bodies of two methods are the same then it  
can use the same Java Script method. For example in sudo Java / Java Script  
code:

{{{
var throwUnsupportedOperationExceptionMethod = function() {
 throw new UnsupportedOperationException?();
}
immutableCollection.add = throwUnsupportedOperationExceptionMethod;  
immutableCollection.addAll = throwUnsupportedOperationExceptionMethod;  
immutableCollection.clear = throwUnsupportedOperationExceptionMethod;
}}}
etc...

Java Script does not care if the number of parameters the caller is using  
is different to what is defined. For example you can call with no issue: `
{{{
immutableCollection.add(e);
immutableCollection.clear();
}}}

This could be generalised to reduce the size of any code although it would  
be time consuming to find methods with the same bodies.



For more information:
http://code.google.com/p/google-web-toolkit/wiki/LightweightCollections

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



[gwt-contrib] Re: add support for deprecated currencies in CurrencyList

2009-06-23 Thread andreasst

LGTM


http://gwt-code-reviews.appspot.com/47803

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



[gwt-contrib] [google-web-toolkit commit] r5619 - Retains exception cause chain when GWTRunner fails to instantiate a test class (e.g. due ...

2009-06-23 Thread codesite-noreply

Author: br...@google.com
Date: Tue Jun 23 18:52:00 2009
New Revision: 5619

Modified:
trunk/user/src/com/google/gwt/junit/rebind/GWTRunnerGenerator.java
 
trunk/user/super/com/google/gwt/junit/translatable/com/google/gwt/junit/client/impl/GWTRunner.java

Log:
Retains exception cause chain when GWTRunner fails to instantiate a test  
class (e.g. due to an exception in the test's ctor or initializer).  
Previously, it was really hard to figure out what was going wrong in web  
mode in this circumstance.

Suggested by: me
Patch by: scottb
Review by: me



Modified: trunk/user/src/com/google/gwt/junit/rebind/GWTRunnerGenerator.java
==
--- trunk/user/src/com/google/gwt/junit/rebind/GWTRunnerGenerator.java   
(original)
+++ trunk/user/src/com/google/gwt/junit/rebind/GWTRunnerGenerator.java  Tue  
Jun 23 18:52:00 2009
@@ -169,8 +169,6 @@
  sw.println();
  sw.println(protected final GWTTestCase createNewTestCase(String  
testClass) {);
  sw.indent();
-sw.println(try {);
-sw.indent();
  boolean isFirst = true;
  for (String className : testClasses) {
if (isFirst) {
@@ -183,11 +181,6 @@
sw.indentln(return GWT.create( + className + .class););
sw.println(});
  }
-sw.outdent();
-sw.println(} catch (Throwable t) {);
-sw.indentln(// Crash in a useful manner);
-sw.indentln(GWT.log(\Unable to construct TestCase: \ + testClass,  
t););
-sw.println(});
  sw.println(return null;);
  sw.outdent();
  sw.println(});

Modified:  
trunk/user/super/com/google/gwt/junit/translatable/com/google/gwt/junit/client/impl/GWTRunner.java
==
---  
trunk/user/super/com/google/gwt/junit/translatable/com/google/gwt/junit/client/impl/GWTRunner.java
   
(original)
+++  
trunk/user/super/com/google/gwt/junit/translatable/com/google/gwt/junit/client/impl/GWTRunner.java
   
Tue Jun 23 18:52:00 2009
@@ -176,10 +176,16 @@

private void runTest() {
  // Dynamically create a new test case.
-GWTTestCase testCase = createNewTestCase(currentTest.getTestClass());
+GWTTestCase testCase = null;
+Throwable caught = null;
+try {
+  testCase = createNewTestCase(currentTest.getTestClass());
+} catch (Throwable e) {
+  caught = e;
+}
  if (testCase == null) {
RuntimeException ex = new RuntimeException(currentTest
-  + : could not instantiate the requested class);
+  + : could not instantiate the requested class, caught);
JUnitResult result = new JUnitResult();
result.setExceptionWrapper(new ExceptionWrapper(ex));
reportResultsAndGetNextMethod(result);

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



[gwt-contrib] [google-web-toolkit commit] r5617 - Allows GWTTestCase#getModuleName() to return null to indicate it should be run as a norma...

2009-06-23 Thread codesite-noreply

Author: br...@google.com
Date: Tue Jun 23 17:40:28 2009
New Revision: 5617

Modified:
trunk/user/src/com/google/gwt/junit/client/GWTTestCase.java
trunk/user/src/com/google/gwt/junit/tools/GWTTestSuite.java

Log:
Allows GWTTestCase#getModuleName() to return null to indicate it should be  
run as a normal JUnit tests case even though it extends GWTTestCase. See  
the issue for the rationale.

Patch by: bruce
Review by: scottb, amitmanjhi
Issue: 3772



Modified: trunk/user/src/com/google/gwt/junit/client/GWTTestCase.java
==
--- trunk/user/src/com/google/gwt/junit/client/GWTTestCase.java (original)
+++ trunk/user/src/com/google/gwt/junit/client/GWTTestCase.java Tue Jun 23  
17:40:28 2009
@@ -118,7 +118,8 @@
 * return the name of a module that will cause the source for that  
subclass to
 * be included.
 *
-   * @return the fully qualified name of a module
+   * @return the fully qualified name of a module, or codenull/code to  
run
+   * as a non-GWT test case
 */
public abstract String getModuleName();

@@ -220,7 +221,14 @@
throw new IllegalArgumentException(GWTTestCases require a name; \  
+ this.toString()
+ \ has none.  Perhaps you used TestSuite.addTest() instead of  
addTestClass()?);
  }
-JUnitShell.runTest(getModuleName(), this, testResult);
+
+String moduleName = getModuleName();
+if (moduleName != null) {
+  JUnitShell.runTest(moduleName, this, testResult);
+} else {
+  // Run as a non-GWT test
+  super.runTest();
+}
}

/**

Modified: trunk/user/src/com/google/gwt/junit/tools/GWTTestSuite.java
==
--- trunk/user/src/com/google/gwt/junit/tools/GWTTestSuite.java (original)
+++ trunk/user/src/com/google/gwt/junit/tools/GWTTestSuite.java Tue Jun 23  
17:40:28 2009
@@ -76,22 +76,29 @@
} else {
  return getModuleSuiteFor(suite.testAt(0));
}
-} else if (test instanceof GWTTestCase) {
+}
+
+if (test instanceof GWTTestCase) {
GWTTestCase gwtTest = (GWTTestCase) test;
-  TestSuite suite = moduleSuites.get(gwtTest.getModuleName());
-  if (suite == null) {
-suite = new TestSuite(gwtTest.getModuleName() + .gwt.xml);
-moduleSuites.put(gwtTest.getModuleName(), suite);
-super.addTest(suite);
-  }
-  return suite;
-} else {
-  if (nonGWTTestSuite == null) {
-nonGWTTestSuite = new TestSuite(Non-GWT);
-super.addTest(nonGWTTestSuite);
+  String moduleName = gwtTest.getModuleName();
+  if (moduleName != null) {
+TestSuite suite = moduleSuites.get(moduleName);
+if (suite == null) {
+  suite = new TestSuite(moduleName + .gwt.xml);
+  moduleSuites.put(moduleName, suite);
+  super.addTest(suite);
+}
+return suite;
+  } else {
+// Fall-through to group with non-GWT tests.
}
-  return nonGWTTestSuite;
  }
+
+if (nonGWTTestSuite == null) {
+  nonGWTTestSuite = new TestSuite(Non-GWT);
+  super.addTest(nonGWTTestSuite);
+}
+return nonGWTTestSuite;
}

/**

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



[gwt-contrib] [google-web-toolkit commit] r5616 - Fix incorrect parsing in java.sql.Date, where leading zeros triggered octal

2009-06-23 Thread codesite-noreply

Author: j...@google.com
Date: Tue Jun 23 16:19:42 2009
New Revision: 5616

Modified:
trunk/user/super/com/google/gwt/emul/java/sql/Date.java
trunk/user/test/com/google/gwt/emultest/java/sql/SqlDateTest.java

Log:
Fix incorrect parsing in java.sql.Date, where leading zeros triggered octal
parsing (so 08 was not valid) and 0xA was considered a valid component.

Patch by: jat
Review by: jgw (TBR)
Issue: 3731


Modified: trunk/user/super/com/google/gwt/emul/java/sql/Date.java
==
--- trunk/user/super/com/google/gwt/emul/java/sql/Date.java (original)
+++ trunk/user/super/com/google/gwt/emul/java/sql/Date.java Tue Jun 23  
16:19:42 2009
@@ -28,10 +28,10 @@

  try {
// Years are relative to 1900
-  int y = Integer.decode(split[0]) - 1900;
+  int y = Integer.parseInt(split[0]) - 1900;
// Months are internally 0-based
-  int m = Integer.decode(split[1]) - 1;
-  int d = Integer.decode(split[2]);
+  int m = Integer.parseInt(split[1]) - 1;
+  int d = Integer.parseInt(split[2]);

return new Date(y, m, d);
  } catch (NumberFormatException e) {

Modified: trunk/user/test/com/google/gwt/emultest/java/sql/SqlDateTest.java
==
--- trunk/user/test/com/google/gwt/emultest/java/sql/SqlDateTest.java
(original)
+++ trunk/user/test/com/google/gwt/emultest/java/sql/SqlDateTest.java   Tue  
Jun 23 16:19:42 2009
@@ -30,6 +30,7 @@
/**
 * Sets module name so that javascript compiler can operate.
 */
+  @Override
public String getModuleName() {
  return com.google.gwt.emultest.EmulSuite;
}
@@ -116,5 +117,18 @@

  Date d2 = Date.valueOf(d.toString());
  assertEquals(d, d2);
+
+// validate that leading zero's don't trigger octal eval
+d = Date.valueOf(2009-08-08);
+assertEquals(109, d.getYear());
+assertEquals(7, d.getMonth());
+assertEquals(8, d.getDate());
+
+// validate 0x isn't a valid prefix
+try {
+  d = Date.valueOf(2009-0xA-0xB);
+  fail(Should have thrown IllegalArgumentException);
+} catch (IllegalArgumentException expected) {
+}
}
  }

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



[gwt-contrib] [google-web-toolkit commit] r5618 - Added exactly one space in a comment.

2009-06-23 Thread codesite-noreply

Author: br...@google.com
Date: Tue Jun 23 17:49:16 2009
New Revision: 5618

Modified:
trunk/user/src/com/google/gwt/junit/client/GWTTestCase.java

Log:
Added exactly one space in a comment.

Suggested by: scottb
Patch by: bruce

Smallest. Change. Ever.



Modified: trunk/user/src/com/google/gwt/junit/client/GWTTestCase.java
==
--- trunk/user/src/com/google/gwt/junit/client/GWTTestCase.java (original)
+++ trunk/user/src/com/google/gwt/junit/client/GWTTestCase.java Tue Jun 23  
17:49:16 2009
@@ -49,7 +49,7 @@
 * could go wrong if you run code there, trying to run a JSNI method  
could
 * generate an {...@link UnsatisfiedLinkError}, and trying to call
 * {...@link com.google.gwt.core.client.GWT#create(Class)} could throw an
-   * {...@link UnsupportedOperationException}.Instead, override
+   * {...@link UnsupportedOperationException}. Instead, override
 * {...@link #gwtSetUp()} and perform any initialization code there.
 */
public GWTTestCase() {

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