[gwt-contrib] [google-web-toolkit] r10128 committed - Improve runtime locales support, so runtime locales that are under a...
Revision: 10128 Author: j...@google.com Date: Mon May 2 20:14:38 2011 Log: Improve runtime locales support, so runtime locales that are under a more specific compile-time locale do not appear under a more general one. An example would be compile locales of [es, es-419] and runtime locales of [es-es, es-co, es-ar] -- the runtime locales for es should not include es-co and es-ar since they are also under es-419. Review at http://gwt-code-reviews.appspot.com/1421812 Review by: unn...@google.com http://code.google.com/p/google-web-toolkit/source/detail?r=10128 Added: /trunk/user/test/com/google/gwt/i18n/rebind/LocaleUtilsTest.java Modified: /trunk/user/src/com/google/gwt/i18n/rebind/LocaleUtils.java /trunk/user/src/com/google/gwt/i18n/server/GwtLocaleImpl.java /trunk/user/test/com/google/gwt/i18n/I18NSuite.java === --- /dev/null +++ /trunk/user/test/com/google/gwt/i18n/rebind/LocaleUtilsTest.java Mon May 2 20:14:38 2011 @@ -0,0 +1,321 @@ +/* + * Copyright 2011 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.i18n.rebind; + +import com.google.gwt.core.ext.BadPropertyValueException; +import com.google.gwt.core.ext.ConfigurationProperty; +import com.google.gwt.core.ext.DefaultConfigurationProperty; +import com.google.gwt.core.ext.GeneratorContext; +import com.google.gwt.core.ext.PropertyOracle; +import com.google.gwt.core.ext.SelectionProperty; +import com.google.gwt.core.ext.TreeLogger; +import com.google.gwt.dev.shell.FailErrorLogger; +import com.google.gwt.i18n.shared.GwtLocale; +import com.google.gwt.i18n.shared.GwtLocaleFactory; + +import junit.framework.TestCase; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.SortedSet; +import java.util.TreeMap; +import java.util.TreeSet; + +/** + * Test for {@link LocaleUtils}. + */ +public class LocaleUtilsTest extends TestCase { + + /** + * Mock config property that gets the values in the constructor. + */ + public class MockConfigProperty extends DefaultConfigurationProperty { + +/** + * @param name + * @param values + */ +public MockConfigProperty(String name, String... values) { + super(name, Arrays.asList(values)); +} + } + + private static class MockPropertyOracle implements PropertyOracle { + +private final MapString, ConfigurationProperty configProperties; +private final MapString, SelectionProperty selectionProperties; + +/** + * + */ +public MockPropertyOracle() { + configProperties = new TreeMapString, ConfigurationProperty(); + selectionProperties = new TreeMapString, SelectionProperty(); +} + +public ConfigurationProperty getConfigurationProperty(String propertyName) +throws BadPropertyValueException { + ConfigurationProperty prop = configProperties.get(propertyName); + if (prop == null) { +throw new BadPropertyValueException(propertyName); + } + return prop; +} + +@Deprecated +public String getPropertyValue(TreeLogger logger, String propertyName) +throws BadPropertyValueException { + SelectionProperty prop = getSelectionProperty(logger, propertyName); + return prop.getCurrentValue(); +} + +@Deprecated +public String[] getPropertyValueSet(TreeLogger logger, String propertyName) +throws BadPropertyValueException { + SelectionProperty prop = getSelectionProperty(logger, propertyName); + SortedSetString possibleValues = prop.getPossibleValues(); + return possibleValues.toArray(new String[possibleValues.size()]); +} + +public SelectionProperty getSelectionProperty(TreeLogger logger, String propertyName) +throws BadPropertyValueException { + SelectionProperty prop = selectionProperties.get(propertyName); + if (prop == null) { +throw new BadPropertyValueException(propertyName); + } + return prop; +} + +public void setProperty(ConfigurationProperty prop) { + configProperties.put(prop.getName(), prop); +} + +public void setProperty(SelectionProperty prop) { + selectionProperties.put(prop.getName(), prop); +} + } + + /** + * Mock selection property; + */ + private static class MockSelectionProperty implements SelectionProperty { + +private String fallbackValue; +private final
[gwt-contrib] Re: Issue 6193: Fix memory-leak in WeakMapping when the value holds a reference on the key (issue1401802)
http://gwt-code-reviews.appspot.com/1401802/ -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Force locale to en_US for user unit tests (issue1430801)
Reviewers: rjrjr, bobv, Description: Force locale to en_US for user unit tests Force locale to en_US for user unit tests, otherwise validation tests fail (use hard-coded checks on locale-dependent messages) Please review this at http://gwt-code-reviews.appspot.com/1430801/ Affected files: M user/build.xml Index: user/build.xml diff --git a/user/build.xml b/user/build.xml index 4f6286fd2e654d9b63ad55bc393807b23954c084..e7696fff725e9e66ee2072d7975173bbc420f178 100755 --- a/user/build.xml +++ b/user/build.xml @@ -2,7 +2,8 @@ property name=gwt.root location=.. / property name=project.tail value=user / property name=test.args value=-ea / - property name=test.jvmargs value=-ea / + !-- Bean validation and RequestFactory tests use hard-coded checks on locale-dependent messages -- + property name=test.jvmargs value=-ea -Duser.language=en -Duser.region=US / !-- support old variables names -- condition property=gwt.hosts.web.remote value=${gwt.remote.browsers} @@ -763,7 +764,7 @@ excludes=${gwt.tck.testcase.dev.excludes} / gwt.junit test.name=test.dev.htmlunit test.args=${test.args} -standardsMode - test.jvmargs=-ea -Dcom.google.gwt.sample.validationtck.util.Failing.include=true -Dcom.google.gwt.sample.validationtck.util.NonTckTest.exclude=true + test.jvmargs=${test.jvmargs} -Dcom.google.gwt.sample.validationtck.util.Failing.include=true -Dcom.google.gwt.sample.validationtck.util.NonTckTest.exclude=true test.out=${junit.out}/tck-dev-htmlunit test.cases=tck.dev.htmlunit.tests haltonfailure=false -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Adds ability to include SafeHtml objects in dom based UI's if the lazy (issue1421811)
Thanks! On Mon, May 2, 2011 at 6:19 PM, rj...@google.com wrote: Hey there Rodrigo. Unnur is on point for this review, but you might find it interesting. http://gwt-code-reviews.appspot.com/1421811/ -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: SafeHtmlRenderer code gen for UiBinder. (issue1427810)
Yes, I thought it was less confusing to start from what was present in http://gwt-code-reviews.appspot.com/1426803 and then make changes. Makes it easier to see differences and such. On Mon, May 2, 2011 at 7:03 PM, Ray Ryan rj...@google.com wrote: This still appears to have all the problems of http://gwt-code-reviews.appspot.com/1426803. On Mon, May 2, 2011 at 11:33 AM, rchan...@google.com wrote: Reviewers: rjrjr, Description: SafeHtmlRenderer code gen for UiBinder. Picking-up patch from rietveld issue 1426803 Please review this at http://gwt-code-reviews.appspot.com/1427810/ Affected files: M user/src/com/google/gwt/uibinder/UiBinder.gwt.xml M user/src/com/google/gwt/uibinder/elementparsers/CustomButtonParser.java M user/src/com/google/gwt/uibinder/elementparsers/DialogBoxParser.java M user/src/com/google/gwt/uibinder/elementparsers/DomElementParser.java M user/src/com/google/gwt/uibinder/elementparsers/GridParser.java M user/src/com/google/gwt/uibinder/elementparsers/HTMLPanelParser.java M user/src/com/google/gwt/uibinder/elementparsers/HasHTMLParser.java M user/src/com/google/gwt/uibinder/elementparsers/StackLayoutPanelParser.java M user/src/com/google/gwt/uibinder/elementparsers/TabLayoutPanelParser.java M user/src/com/google/gwt/uibinder/elementparsers/TabPanelParser.java M user/src/com/google/gwt/uibinder/rebind/AbstractFieldWriter.java M user/src/com/google/gwt/uibinder/rebind/FieldManager.java M user/src/com/google/gwt/uibinder/rebind/FieldWriter.java M user/src/com/google/gwt/uibinder/rebind/UiBinderWriter.java -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Issue 6081: ListEditor subeditors' value is not flushed when used with a RequestFactoryEditorDriver (issue1371801)
http://gwt-code-reviews.appspot.com/1371801/ -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Add SafeUri type, similar to SafeHtml but for values in a URL attribute context. (issue1380806)
http://gwt-code-reviews.appspot.com/1380806/diff/28033/user/src/com/google/gwt/safehtml/shared/SafeUri.java File user/src/com/google/gwt/safehtml/shared/SafeUri.java (right): http://gwt-code-reviews.appspot.com/1380806/diff/28033/user/src/com/google/gwt/safehtml/shared/SafeUri.java#newcode41 user/src/com/google/gwt/safehtml/shared/SafeUri.java:41: * context in which the URL is used matters too (link {@code href} vs. image On 2011/05/02 18:57:13, skybrian wrote: This sounds somewhat dangerous, actually. It seems like if context matters, either each context should have its own type, or creators of SafeUrl instances should stick to the lowest common denominator. The reason is that the code creating a SafeUrl instance might be far removed from the code that uses it. If the creator believes that a URL will be used in iframe context, but actually it isn't, then reviewers cannot find the problem without having an end-to-end understanding of the program's data flow, and any refactoring of intermediate code has the potential to introduce a bug without a type error and without the reviewers seeing anything wrong. It seems like the whole point of having safe types with clear contracts is make sure that local reviews are sufficient to guarantee safety? I hate the complexity this is likely to introduce, but on the other hand, a SafeUrl type that isn't actually safe doesn't sound so great either. I think I agree with Brian on this one. Can we specify the contract such that a SafeUri is safe to use in any of these contexts (at the expense of being overly restrictive, for e.g. img src URIs)? If not, I think we need to introduces separate types. Otherwise we'll loose the local revieability benefit of the SafeXyz types. http://gwt-code-reviews.appspot.com/1380806/ -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Add SafeUri type, similar to SafeHtml but for values in a URL attribute context. (issue1380806)
On 2011/05/03 16:11:37, xtof wrote: http://gwt-code-reviews.appspot.com/1380806/diff/28033/user/src/com/google/gwt/safehtml/shared/SafeUri.java File user/src/com/google/gwt/safehtml/shared/SafeUri.java (right): http://gwt-code-reviews.appspot.com/1380806/diff/28033/user/src/com/google/gwt/safehtml/shared/SafeUri.java#newcode41 user/src/com/google/gwt/safehtml/shared/SafeUri.java:41: * context in which the URL is used matters too (link {@code href} vs. image On 2011/05/02 18:57:13, skybrian wrote: This sounds somewhat dangerous, actually. It seems like if context matters, either each context should have its own type, or creators of SafeUrl instances should stick to the lowest common denominator. The reason is that the code creating a SafeUrl instance might be far removed from the code that uses it. If the creator believes that a URL will be used in iframe context, but actually it isn't, then reviewers cannot find the problem without having an end-to-end understanding of the program's data flow, and any refactoring of intermediate code has the potential to introduce a bug without a type error and without the reviewers seeing anything wrong. It seems like the whole point of having safe types with clear contracts is make sure that local reviews are sufficient to guarantee safety? I hate the complexity this is likely to introduce, but on the other hand, a SafeUrl type that isn't actually safe doesn't sound so great either. I think I agree with Brian on this one. Can we specify the contract such that a SafeUri is safe to use in any of these contexts (at the expense of being overly restrictive, for e.g. img src URIs)? If not, I think we need to introduces separate types. Otherwise we'll loose the local revieability benefit of the SafeXyz types. If that's the only point left, can you make the edit yourself before submitting? (as, while I agree, I don't know what to say exactly here) Otherwise, if there are other comments requiring a new patchset, then I'll try to address this one at the same time. TIA http://gwt-code-reviews.appspot.com/1380806/ -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Promoting LazyDomElement to be used externally. LazyDomElement can be (issue1427809)
http://gwt-code-reviews.appspot.com/1427809/ -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Promoting LazyDomElement to be used externally. LazyDomElement can be (issue1427809)
LGTM with one nit fixed. Thanks for the tests. http://gwt-code-reviews.appspot.com/1427809/diff/1010/user/src/com/google/gwt/uibinder/rebind/model/OwnerField.java File user/src/com/google/gwt/uibinder/rebind/model/OwnerField.java (right): http://gwt-code-reviews.appspot.com/1427809/diff/1010/user/src/com/google/gwt/uibinder/rebind/model/OwnerField.java#newcode85 user/src/com/google/gwt/uibinder/rebind/model/OwnerField.java:85: public JClassType getRawType() { Please inline this. http://gwt-code-reviews.appspot.com/1427809/diff/1010/user/test/com/google/gwt/uibinder/rebind/FieldWriterOfExistingTypeTest.java File user/test/com/google/gwt/uibinder/rebind/FieldWriterOfExistingTypeTest.java (right): http://gwt-code-reviews.appspot.com/1427809/diff/1010/user/test/com/google/gwt/uibinder/rebind/FieldWriterOfExistingTypeTest.java#newcode22 user/test/com/google/gwt/uibinder/rebind/FieldWriterOfExistingTypeTest.java:22: public class FieldWriterOfExistingTypeTest extends TestCase { I forgot how handy EasyMock is http://gwt-code-reviews.appspot.com/1427809/ -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Force locale to en_US for user unit tests (issue1430801)
LGTM Thanks, will submit. On Tue, May 3, 2011 at 2:40 AM, t.bro...@gmail.com wrote: Reviewers: rjrjr, bobv, Description: Force locale to en_US for user unit tests Force locale to en_US for user unit tests, otherwise validation tests fail (use hard-coded checks on locale-dependent messages) Please review this at http://gwt-code-reviews.appspot.com/1430801/ Affected files: M user/build.xml Index: user/build.xml diff --git a/user/build.xml b/user/build.xml index 4f6286fd2e654d9b63ad55bc393807b23954c084..e7696fff725e9e66ee2072d7975173bbc420f178 100755 --- a/user/build.xml +++ b/user/build.xml @@ -2,7 +2,8 @@ property name=gwt.root location=.. / property name=project.tail value=user / property name=test.args value=-ea / - property name=test.jvmargs value=-ea / + !-- Bean validation and RequestFactory tests use hard-coded checks on locale-dependent messages -- + property name=test.jvmargs value=-ea -Duser.language=en -Duser.region=US / !-- support old variables names -- condition property=gwt.hosts.web.remote value=${gwt.remote.browsers} @@ -763,7 +764,7 @@ excludes=${gwt.tck.testcase.dev.excludes} / gwt.junit test.name=test.dev.htmlunit test.args=${test.args} -standardsMode - test.jvmargs=-ea -Dcom.google.gwt.sample.validationtck.util.Failing.include=true -Dcom.google.gwt.sample.validationtck.util.NonTckTest.exclude=true + test.jvmargs=${test.jvmargs} -Dcom.google.gwt.sample.validationtck.util.Failing.include=true -Dcom.google.gwt.sample.validationtck.util.NonTckTest.exclude=true test.out=${junit.out}/tck-dev-htmlunit test.cases=tck.dev.htmlunit.tests haltonfailure=false -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Fix error in usage of newly-creted helper method in AttachableHTMLPanel, correct double-calling ... (issue1427812)
Reviewers: rjrjr, Description: Fix error in usage of newly-creted helper method in AttachableHTMLPanel, correct double-calling of wrapElement in exceptional case, and fix the documentation. Please review this at http://gwt-code-reviews.appspot.com/1427812/ Affected files: M user/src/com/google/gwt/user/client/ui/AttachableHTMLPanel.java Index: user/src/com/google/gwt/user/client/ui/AttachableHTMLPanel.java === --- user/src/com/google/gwt/user/client/ui/AttachableHTMLPanel.java (revision 10128) +++ user/src/com/google/gwt/user/client/ui/AttachableHTMLPanel.java (working copy) @@ -202,14 +202,16 @@ @Override public void wrapElement(Element element) { -if (!isFullyInitialized()) { - // NOTE(rdcastro): This code is only run when Attachable is in active use. +if (isFullyInitialized()) { + // If wrapElement is being called after the widget is fully initialized, + // all we have to do is replace the given element with the the DOM tree + // we already built. element.getParentNode().replaceChild(getElement(), element); -} else { - setElement(element); - html = null; -} - + return; +} + +setElement(element); +html = null; if (wrapInitializationCallback != null) { wrapInitializationCallback.execute(); wrapInitializationCallback = null; -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Promoting LazyDomElement to be used externally. LazyDomElement can be (issue1427809)
http://gwt-code-reviews.appspot.com/1427809/diff/1/user/src/com/google/gwt/uibinder/client/LazyDomElement.java File user/src/com/google/gwt/uibinder/client/LazyDomElement.java (right): http://gwt-code-reviews.appspot.com/1427809/diff/1/user/src/com/google/gwt/uibinder/client/LazyDomElement.java#newcode33 user/src/com/google/gwt/uibinder/client/LazyDomElement.java:33: * lt;div ui:field=myDiv class={anyClass}/gt; On 2011/05/02 16:51:54, rjrjr wrote: The class bit is noise, can you snip it? Done. http://gwt-code-reviews.appspot.com/1427809/diff/1/user/src/com/google/gwt/uibinder/client/LazyDomElement.java#newcode45 user/src/com/google/gwt/uibinder/client/LazyDomElement.java:45: */ On 2011/05/02 16:51:54, rjrjr wrote: /** * Creates an instance to fetch the element with the given id. */ Done. http://gwt-code-reviews.appspot.com/1427809/diff/1/user/src/com/google/gwt/uibinder/client/LazyDomElement.java#newcode54 user/src/com/google/gwt/uibinder/client/LazyDomElement.java:54: On 2011/05/02 16:51:54, rjrjr wrote: /** * Returns the dom element * @return the dom element * @throws RuntimeException is the element cannot be found */ Done. http://gwt-code-reviews.appspot.com/1427809/diff/1/user/src/com/google/gwt/uibinder/client/LazyDomElement.java#newcode59 user/src/com/google/gwt/uibinder/client/LazyDomElement.java:59: throw new RuntimeException(Element is not attached.); On 2011/05/02 16:51:54, rjrjr wrote: Cannot find element with id \ + domId + \. Perhaps it is not attached to the document body? Done. http://gwt-code-reviews.appspot.com/1427809/diff/1/user/src/com/google/gwt/uibinder/rebind/FieldWriterOfLazyDomElement.java File user/src/com/google/gwt/uibinder/rebind/FieldWriterOfLazyDomElement.java (right): http://gwt-code-reviews.appspot.com/1427809/diff/1/user/src/com/google/gwt/uibinder/rebind/FieldWriterOfLazyDomElement.java#newcode46 user/src/com/google/gwt/uibinder/rebind/FieldWriterOfLazyDomElement.java:46: if (!templateFieldType.isAssignableTo(parameterType)) { On 2011/05/02 16:51:54, rjrjr wrote: Needs a unit test. See FieldWriterOfGeneratedCssResourceTest for example. Done. http://gwt-code-reviews.appspot.com/1427809/diff/1/user/src/com/google/gwt/uibinder/rebind/UiBinderWriter.java File user/src/com/google/gwt/uibinder/rebind/UiBinderWriter.java (right): http://gwt-code-reviews.appspot.com/1427809/diff/1/user/src/com/google/gwt/uibinder/rebind/UiBinderWriter.java#newcode380 user/src/com/google/gwt/uibinder/rebind/UiBinderWriter.java:380: // But if the owner field is an instance of LazyDomElement then the code On 2011/05/02 16:51:54, rjrjr wrote: /* for long comments Done. http://gwt-code-reviews.appspot.com/1427809/diff/1/user/src/com/google/gwt/uibinder/rebind/UiBinderWriter.java#newcode463 user/src/com/google/gwt/uibinder/rebind/UiBinderWriter.java:463: // We can switch types if useLazyWidgetBuilders is enabled and the On 2011/05/02 16:51:54, rjrjr wrote: /* Done. http://gwt-code-reviews.appspot.com/1427809/diff/1/user/src/com/google/gwt/uibinder/rebind/UiBinderWriter.java#newcode710 user/src/com/google/gwt/uibinder/rebind/UiBinderWriter.java:710: return lazyDomElementClass.isAssignableFrom(ownerField.getType().getRawType()); On 2011/05/02 16:51:54, rjrjr wrote: Can getRawType can return null? Is isAssignableFrom null safe? Nop, OwnerField dies if it can't resolve the type. http://gwt-code-reviews.appspot.com/1427809/diff/1010/user/src/com/google/gwt/uibinder/rebind/model/OwnerField.java File user/src/com/google/gwt/uibinder/rebind/model/OwnerField.java (right): http://gwt-code-reviews.appspot.com/1427809/diff/1010/user/src/com/google/gwt/uibinder/rebind/model/OwnerField.java#newcode85 user/src/com/google/gwt/uibinder/rebind/model/OwnerField.java:85: public JClassType getRawType() { On 2011/05/03 16:37:02, rjrjr wrote: Please inline this. You meant remove this method? This is very handy for tests. http://gwt-code-reviews.appspot.com/1427809/diff/1010/user/test/com/google/gwt/uibinder/rebind/FieldWriterOfExistingTypeTest.java File user/test/com/google/gwt/uibinder/rebind/FieldWriterOfExistingTypeTest.java (right): http://gwt-code-reviews.appspot.com/1427809/diff/1010/user/test/com/google/gwt/uibinder/rebind/FieldWriterOfExistingTypeTest.java#newcode22 user/test/com/google/gwt/uibinder/rebind/FieldWriterOfExistingTypeTest.java:22: public class FieldWriterOfExistingTypeTest extends TestCase { On 2011/05/03 16:37:02, rjrjr wrote: I forgot how handy EasyMock is True. http://gwt-code-reviews.appspot.com/1427809/ -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Promoting LazyDomElement to be used externally. LazyDomElement can be (issue1427809)
On Tue, May 3, 2011 at 9:49 AM, her...@google.com wrote: http://gwt-code-reviews.appspot.com/1427809/diff/1/user/src/com/google/gwt/uibinder/client/LazyDomElement.java File user/src/com/google/gwt/uibinder/client/LazyDomElement.java (right): http://gwt-code-reviews.appspot.com/1427809/diff/1/user/src/com/google/gwt/uibinder/client/LazyDomElement.java#newcode33 user/src/com/google/gwt/uibinder/client/LazyDomElement.java:33: * lt;div ui:field=myDiv class={anyClass}/gt; On 2011/05/02 16:51:54, rjrjr wrote: The class bit is noise, can you snip it? Done. http://gwt-code-reviews.appspot.com/1427809/diff/1/user/src/com/google/gwt/uibinder/client/LazyDomElement.java#newcode45 user/src/com/google/gwt/uibinder/client/LazyDomElement.java:45: */ On 2011/05/02 16:51:54, rjrjr wrote: /** * Creates an instance to fetch the element with the given id. */ Done. http://gwt-code-reviews.appspot.com/1427809/diff/1/user/src/com/google/gwt/uibinder/client/LazyDomElement.java#newcode54 user/src/com/google/gwt/uibinder/client/LazyDomElement.java:54: On 2011/05/02 16:51:54, rjrjr wrote: /** * Returns the dom element * @return the dom element * @throws RuntimeException is the element cannot be found */ Done. http://gwt-code-reviews.appspot.com/1427809/diff/1/user/src/com/google/gwt/uibinder/client/LazyDomElement.java#newcode59 user/src/com/google/gwt/uibinder/client/LazyDomElement.java:59: throw new RuntimeException(Element is not attached.); On 2011/05/02 16:51:54, rjrjr wrote: Cannot find element with id \ + domId + \. Perhaps it is not attached to the document body? Done. http://gwt-code-reviews.appspot.com/1427809/diff/1/user/src/com/google/gwt/uibinder/rebind/FieldWriterOfLazyDomElement.java File user/src/com/google/gwt/uibinder/rebind/FieldWriterOfLazyDomElement.java (right): http://gwt-code-reviews.appspot.com/1427809/diff/1/user/src/com/google/gwt/uibinder/rebind/FieldWriterOfLazyDomElement.java#newcode46 user/src/com/google/gwt/uibinder/rebind/FieldWriterOfLazyDomElement.java:46: if (!templateFieldType.isAssignableTo(parameterType)) { On 2011/05/02 16:51:54, rjrjr wrote: Needs a unit test. See FieldWriterOfGeneratedCssResourceTest for example. Done. http://gwt-code-reviews.appspot.com/1427809/diff/1/user/src/com/google/gwt/uibinder/rebind/UiBinderWriter.java File user/src/com/google/gwt/uibinder/rebind/UiBinderWriter.java (right): http://gwt-code-reviews.appspot.com/1427809/diff/1/user/src/com/google/gwt/uibinder/rebind/UiBinderWriter.java#newcode380 user/src/com/google/gwt/uibinder/rebind/UiBinderWriter.java:380: // But if the owner field is an instance of LazyDomElement then the code On 2011/05/02 16:51:54, rjrjr wrote: /* for long comments Done. http://gwt-code-reviews.appspot.com/1427809/diff/1/user/src/com/google/gwt/uibinder/rebind/UiBinderWriter.java#newcode463 user/src/com/google/gwt/uibinder/rebind/UiBinderWriter.java:463: // We can switch types if useLazyWidgetBuilders is enabled and the On 2011/05/02 16:51:54, rjrjr wrote: /* Done. http://gwt-code-reviews.appspot.com/1427809/diff/1/user/src/com/google/gwt/uibinder/rebind/UiBinderWriter.java#newcode710 user/src/com/google/gwt/uibinder/rebind/UiBinderWriter.java:710: return lazyDomElementClass.isAssignableFrom(ownerField.getType().getRawType()); On 2011/05/02 16:51:54, rjrjr wrote: Can getRawType can return null? Is isAssignableFrom null safe? Nop, OwnerField dies if it can't resolve the type. http://gwt-code-reviews.appspot.com/1427809/diff/1010/user/src/com/google/gwt/uibinder/rebind/model/OwnerField.java File user/src/com/google/gwt/uibinder/rebind/model/OwnerField.java (right): http://gwt-code-reviews.appspot.com/1427809/diff/1010/user/src/com/google/gwt/uibinder/rebind/model/OwnerField.java#newcode85 user/src/com/google/gwt/uibinder/rebind/model/OwnerField.java:85: public JClassType getRawType() { On 2011/05/03 16:37:02, rjrjr wrote: Please inline this. You meant remove this method? This is very handy for tests. Oh, I see. Could you put a comment in the method body to that effect? http://gwt-code-reviews.appspot.com/1427809/diff/1010/user/test/com/google/gwt/uibinder/rebind/FieldWriterOfExistingTypeTest.java File user/test/com/google/gwt/uibinder/rebind/FieldWriterOfExistingTypeTest.java (right): http://gwt-code-reviews.appspot.com/1427809/diff/1010/user/test/com/google/gwt/uibinder/rebind/FieldWriterOfExistingTypeTest.java#newcode22 user/test/com/google/gwt/uibinder/rebind/FieldWriterOfExistingTypeTest.java:22: public class FieldWriterOfExistingTypeTest extends TestCase { On 2011/05/03 16:37:02, rjrjr wrote: I forgot how handy EasyMock is True. http://gwt-code-reviews.appspot.com/1427809/ -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Promoting LazyDomElement to be used externally. LazyDomElement can be (issue1427809)
LGTM On Tue, May 3, 2011 at 9:54 AM, Ray Ryan rj...@google.com wrote: On Tue, May 3, 2011 at 9:49 AM, her...@google.com wrote: http://gwt-code-reviews.appspot.com/1427809/diff/1/user/src/com/google/gwt/uibinder/client/LazyDomElement.java File user/src/com/google/gwt/uibinder/client/LazyDomElement.java (right): http://gwt-code-reviews.appspot.com/1427809/diff/1/user/src/com/google/gwt/uibinder/client/LazyDomElement.java#newcode33 user/src/com/google/gwt/uibinder/client/LazyDomElement.java:33: * lt;div ui:field=myDiv class={anyClass}/gt; On 2011/05/02 16:51:54, rjrjr wrote: The class bit is noise, can you snip it? Done. http://gwt-code-reviews.appspot.com/1427809/diff/1/user/src/com/google/gwt/uibinder/client/LazyDomElement.java#newcode45 user/src/com/google/gwt/uibinder/client/LazyDomElement.java:45: */ On 2011/05/02 16:51:54, rjrjr wrote: /** * Creates an instance to fetch the element with the given id. */ Done. http://gwt-code-reviews.appspot.com/1427809/diff/1/user/src/com/google/gwt/uibinder/client/LazyDomElement.java#newcode54 user/src/com/google/gwt/uibinder/client/LazyDomElement.java:54: On 2011/05/02 16:51:54, rjrjr wrote: /** * Returns the dom element * @return the dom element * @throws RuntimeException is the element cannot be found */ Done. http://gwt-code-reviews.appspot.com/1427809/diff/1/user/src/com/google/gwt/uibinder/client/LazyDomElement.java#newcode59 user/src/com/google/gwt/uibinder/client/LazyDomElement.java:59: throw new RuntimeException(Element is not attached.); On 2011/05/02 16:51:54, rjrjr wrote: Cannot find element with id \ + domId + \. Perhaps it is not attached to the document body? Done. http://gwt-code-reviews.appspot.com/1427809/diff/1/user/src/com/google/gwt/uibinder/rebind/FieldWriterOfLazyDomElement.java File user/src/com/google/gwt/uibinder/rebind/FieldWriterOfLazyDomElement.java (right): http://gwt-code-reviews.appspot.com/1427809/diff/1/user/src/com/google/gwt/uibinder/rebind/FieldWriterOfLazyDomElement.java#newcode46 user/src/com/google/gwt/uibinder/rebind/FieldWriterOfLazyDomElement.java:46: if (!templateFieldType.isAssignableTo(parameterType)) { On 2011/05/02 16:51:54, rjrjr wrote: Needs a unit test. See FieldWriterOfGeneratedCssResourceTest for example. Done. http://gwt-code-reviews.appspot.com/1427809/diff/1/user/src/com/google/gwt/uibinder/rebind/UiBinderWriter.java File user/src/com/google/gwt/uibinder/rebind/UiBinderWriter.java (right): http://gwt-code-reviews.appspot.com/1427809/diff/1/user/src/com/google/gwt/uibinder/rebind/UiBinderWriter.java#newcode380 user/src/com/google/gwt/uibinder/rebind/UiBinderWriter.java:380: // But if the owner field is an instance of LazyDomElement then the code On 2011/05/02 16:51:54, rjrjr wrote: /* for long comments Done. http://gwt-code-reviews.appspot.com/1427809/diff/1/user/src/com/google/gwt/uibinder/rebind/UiBinderWriter.java#newcode463 user/src/com/google/gwt/uibinder/rebind/UiBinderWriter.java:463: // We can switch types if useLazyWidgetBuilders is enabled and the On 2011/05/02 16:51:54, rjrjr wrote: /* Done. http://gwt-code-reviews.appspot.com/1427809/diff/1/user/src/com/google/gwt/uibinder/rebind/UiBinderWriter.java#newcode710 user/src/com/google/gwt/uibinder/rebind/UiBinderWriter.java:710: return lazyDomElementClass.isAssignableFrom(ownerField.getType().getRawType()); On 2011/05/02 16:51:54, rjrjr wrote: Can getRawType can return null? Is isAssignableFrom null safe? Nop, OwnerField dies if it can't resolve the type. http://gwt-code-reviews.appspot.com/1427809/diff/1010/user/src/com/google/gwt/uibinder/rebind/model/OwnerField.java File user/src/com/google/gwt/uibinder/rebind/model/OwnerField.java (right): http://gwt-code-reviews.appspot.com/1427809/diff/1010/user/src/com/google/gwt/uibinder/rebind/model/OwnerField.java#newcode85 user/src/com/google/gwt/uibinder/rebind/model/OwnerField.java:85: public JClassType getRawType() { On 2011/05/03 16:37:02, rjrjr wrote: Please inline this. You meant remove this method? This is very handy for tests. Oh, I see. Could you put a comment in the method body to that effect? http://gwt-code-reviews.appspot.com/1427809/diff/1010/user/test/com/google/gwt/uibinder/rebind/FieldWriterOfExistingTypeTest.java File user/test/com/google/gwt/uibinder/rebind/FieldWriterOfExistingTypeTest.java (right): http://gwt-code-reviews.appspot.com/1427809/diff/1010/user/test/com/google/gwt/uibinder/rebind/FieldWriterOfExistingTypeTest.java#newcode22 user/test/com/google/gwt/uibinder/rebind/FieldWriterOfExistingTypeTest.java:22: public class FieldWriterOfExistingTypeTest extends TestCase { On 2011/05/03 16:37:02, rjrjr wrote: I forgot how handy EasyMock is True. http://gwt-code-reviews.appspot.com/1427809/ -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Force locale to en_US for user unit tests (issue1430801)
Running ant clean dist-dev test, this appears to break the i18n suite under html unit. Testcase: testMessageDateTime took 0.15 sec FAILED Remote test failed at 172.31.131.172 / Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.19) Gecko/2010031422 Firefox/3.0.19 expected=It is Feb 15, 2010 actual=It is 2010 Feb 15 junit.framework.AssertionFailedError: Remote test failed at 172.31.131.172 / Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.19) Gecko/2010031422 Firefox/3.0.19 expected=It is Feb 15, 2010 actual=It is 2010 Feb 15 On Tue, May 3, 2011 at 9:42 AM, Ray Ryan rj...@google.com wrote: LGTM Thanks, will submit. On Tue, May 3, 2011 at 2:40 AM, t.bro...@gmail.com wrote: Reviewers: rjrjr, bobv, Description: Force locale to en_US for user unit tests Force locale to en_US for user unit tests, otherwise validation tests fail (use hard-coded checks on locale-dependent messages) Please review this at http://gwt-code-reviews.appspot.com/1430801/ Affected files: M user/build.xml Index: user/build.xml diff --git a/user/build.xml b/user/build.xml index 4f6286fd2e654d9b63ad55bc393807b23954c084..e7696fff725e9e66ee2072d7975173bbc420f178 100755 --- a/user/build.xml +++ b/user/build.xml @@ -2,7 +2,8 @@ property name=gwt.root location=.. / property name=project.tail value=user / property name=test.args value=-ea / - property name=test.jvmargs value=-ea / + !-- Bean validation and RequestFactory tests use hard-coded checks on locale-dependent messages -- + property name=test.jvmargs value=-ea -Duser.language=en -Duser.region=US / !-- support old variables names -- condition property=gwt.hosts.web.remote value=${gwt.remote.browsers} @@ -763,7 +764,7 @@ excludes=${gwt.tck.testcase.dev.excludes} / gwt.junit test.name=test.dev.htmlunit test.args=${test.args} -standardsMode - test.jvmargs=-ea -Dcom.google.gwt.sample.validationtck.util.Failing.include=true -Dcom.google.gwt.sample.validationtck.util.NonTckTest.exclude=true + test.jvmargs=${test.jvmargs} -Dcom.google.gwt.sample.validationtck.util.Failing.include=true -Dcom.google.gwt.sample.validationtck.util.NonTckTest.exclude=true test.out=${junit.out}/tck-dev-htmlunit test.cases=tck.dev.htmlunit.tests haltonfailure=false -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] [google-web-toolkit] r10129 committed - Promoting LazyDomElement to be used externally. LazyDomElement can be...
Revision: 10129 Author: her...@google.com Date: Tue May 3 08:15:07 2011 Log: Promoting LazyDomElement to be used externally. LazyDomElement can be used to boost rendering time. Today, html elements marked with ui:field need to call getElementById() by the time the template is created even if is not used. LazyDomElement delays this. Review at http://gwt-code-reviews.appspot.com/1427809 http://code.google.com/p/google-web-toolkit/source/detail?r=10129 Added: /trunk/user/src/com/google/gwt/uibinder/client/LazyDomElement.java /trunk/user/src/com/google/gwt/uibinder/rebind/FieldWriterOfLazyDomElement.java /trunk/user/test/com/google/gwt/uibinder/rebind/FieldWriterOfExistingTypeTest.java /trunk/user/test/com/google/gwt/uibinder/rebind/FieldWriterOfLazyDomElementTest.java Modified: /trunk/user/src/com/google/gwt/uibinder/client/UiBinderUtil.java /trunk/user/src/com/google/gwt/uibinder/elementparsers/WidgetInterpreter.java /trunk/user/src/com/google/gwt/uibinder/elementparsers/WidgetPlaceholderInterpreter.java /trunk/user/src/com/google/gwt/uibinder/rebind/FieldManager.java /trunk/user/src/com/google/gwt/uibinder/rebind/FieldWriterType.java /trunk/user/src/com/google/gwt/uibinder/rebind/UiBinderWriter.java /trunk/user/src/com/google/gwt/uibinder/rebind/model/OwnerField.java /trunk/user/test/com/google/gwt/uibinder/UiBinderJreSuite.java === --- /dev/null +++ /trunk/user/src/com/google/gwt/uibinder/client/LazyDomElement.java Tue May 3 08:15:07 2011 @@ -0,0 +1,77 @@ +/* + * Copyright 2011 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.uibinder.client; + +import com.google.gwt.dom.client.Document; +import com.google.gwt.dom.client.Element; + +/** + * Wraps a call to a DOM element. LazyDomElement can boost performance of html + * elements and delay calls to getElementById() to when the element is actually + * used. But note that it will throw a RuntimeException in case the element is + * accessed but not yet attached in the DOM tree. + * + * Usage example: + * + * bTemplate:/b + * pre + * lt;gwt:HTMLPanelgt; + * lt;div ui:field=myDiv /gt; + * lt;/gwt:HTMLPanelgt; + * /pre + * + * bClass:/b + * pre + * @UiField LazyDomElementlt;DivElementgt; myDiv; + * + * public setText(String text) { + * myDiv.get().setInnerHtml(text); + * } + * /pre + * + * @param T the Element type associated + */ +public class LazyDomElementT extends Element { + + private T element; + private final String domId; + + /** + * Creates an instance to fetch the element with the given id. + */ + public LazyDomElement(String domId) { +this.domId = domId; + } + + /** + * Returns the dom element. + * + * @return the dom element + * @throws RuntimeException if the element cannot be found + */ + public T get() { +if (element == null) { + element = Document.get().getElementById(domId).cast(); + if (element == null) { +throw new RuntimeException(Cannot find element with id \ + domId ++ \. Perhaps it is not attached to the document body.); + } + element.removeAttribute(id); +} +return element; + } +} === --- /dev/null +++ /trunk/user/src/com/google/gwt/uibinder/rebind/FieldWriterOfLazyDomElement.java Tue May 3 08:15:07 2011 @@ -0,0 +1,72 @@ +/* + * Copyright 2011 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.uibinder.rebind; + +import com.google.gwt.core.ext.UnableToCompleteException; +import com.google.gwt.core.ext.typeinfo.JClassType; +import com.google.gwt.core.ext.typeinfo.JParameterizedType; +import com.google.gwt.uibinder.rebind.model.OwnerField; + +/** + * Implementation of FieldWriter for a {@link com.google.gwt.uibinder.client.LazyDomElement}. + */ +public class FieldWriterOfLazyDomElement extends AbstractFieldWriter
[gwt-contrib] [google-web-toolkit] r10130 committed - Discards the jar file name in the resource location. It isn't necessa...
Revision: 10130 Author: zun...@google.com Date: Tue May 3 08:35:13 2011 Log: Discards the jar file name in the resource location. It isn't necessary, and will cause detritus to build up in the cache if a resource changes from being in one jar to another or moves in/out of a .jar file. Review at http://gwt-code-reviews.appspot.com/1428805 http://code.google.com/p/google-web-toolkit/source/detail?r=10130 Modified: /trunk/dev/core/src/com/google/gwt/dev/javac/CachedCompilationUnit.java /trunk/dev/core/src/com/google/gwt/dev/javac/CompilationStateBuilder.java /trunk/dev/core/src/com/google/gwt/dev/javac/CompilationUnit.java /trunk/dev/core/src/com/google/gwt/dev/javac/CompilationUnitBuilder.java /trunk/dev/core/src/com/google/gwt/dev/javac/MemoryUnitCache.java /trunk/dev/core/src/com/google/gwt/dev/javac/PersistentUnitCache.java /trunk/dev/core/src/com/google/gwt/dev/javac/SourceFileCompilationUnit.java /trunk/dev/core/src/com/google/gwt/dev/javac/UnitCache.java /trunk/dev/core/test/com/google/gwt/dev/javac/MemoryUnitCacheTest.java /trunk/dev/core/test/com/google/gwt/dev/javac/MockCompilationUnit.java /trunk/dev/core/test/com/google/gwt/dev/javac/PersistentUnitCacheTest.java === --- /trunk/dev/core/src/com/google/gwt/dev/javac/CachedCompilationUnit.java Fri Mar 25 16:48:01 2011 +++ /trunk/dev/core/src/com/google/gwt/dev/javac/CachedCompilationUnit.java Tue May 3 08:35:13 2011 @@ -31,6 +31,7 @@ private final ContentId contentId; private final Dependencies dependencies; private final String resourceLocation; + private final String resourcePath; private final ListJsniMethod jsniMethods; private final long lastModified; private final MethodArgNamesLookup methodArgNamesLookup; @@ -55,6 +56,7 @@ this.contentId = unit.getContentId(); this.dependencies = unit.getDependencies(); this.resourceLocation = unit.getResourceLocation(); +this.resourcePath = unit.getResourcePath(); this.jsniMethods = unit.getJsniMethods(); this.lastModified = unit.getLastModified(); this.methodArgNamesLookup = unit.getMethodArgs(); @@ -99,6 +101,11 @@ public String getResourceLocation() { return resourceLocation; } + + @Override + public String getResourcePath() { +return resourcePath; + } @Override @Deprecated === --- /trunk/dev/core/src/com/google/gwt/dev/javac/CompilationStateBuilder.java Thu Apr 28 09:54:26 2011 +++ /trunk/dev/core/src/com/google/gwt/dev/javac/CompilationStateBuilder.java Tue May 3 08:35:13 2011 @@ -393,7 +393,7 @@ ResourceCompilationUnitBuilder builder = new ResourceCompilationUnitBuilder(typeName, resource); - CompilationUnit cachedUnit = unitCache.find(resource.getLocation()); + CompilationUnit cachedUnit = unitCache.find(resource.getPath()); if (cachedUnit != null) { if (cachedUnit.getLastModified() == resource.getLastModified()) { cachedUnits.put(builder, cachedUnit); === --- /trunk/dev/core/src/com/google/gwt/dev/javac/CompilationUnit.java Tue Apr 26 08:02:24 2011 +++ /trunk/dev/core/src/com/google/gwt/dev/javac/CompilationUnit.java Tue May 3 08:35:13 2011 @@ -286,9 +286,18 @@ * virtual location (in the case of generators or mock data) where the source * for this unit originated. This should be unique for each unit compiled to * create a module. + * + * @see {@link com.google.gwt.dev.resource.Resource#getLocation()} */ public abstract String getResourceLocation(); + /** + * Returns the full abstract path of the resource. + * + * @see {@link com.google.gwt.dev.resource.Resource#getPath()} + */ + public abstract String getResourcePath(); + /** * Returns the source code for this unit. */ === --- /trunk/dev/core/src/com/google/gwt/dev/javac/CompilationUnitBuilder.java Fri Mar 25 16:48:01 2011 +++ /trunk/dev/core/src/com/google/gwt/dev/javac/CompilationUnitBuilder.java Tue May 3 08:35:13 2011 @@ -181,6 +181,11 @@ public String getResourceLocation() { return getLocationFor(generatedUnit); } + +@Override +public String getResourcePath() { + return Shared.toPath(generatedUnit.getTypeName()); +} @Deprecated @Override === --- /trunk/dev/core/src/com/google/gwt/dev/javac/MemoryUnitCache.java Thu Mar 24 15:47:57 2011 +++ /trunk/dev/core/src/com/google/gwt/dev/javac/MemoryUnitCache.java Tue May 3 08:35:13 2011 @@ -26,7 +26,7 @@ /** * This cache stores {@link CompilationUnit} instances in a Map. * - * Only one unit is cached per resource location. If the contentId of the unit + * Only one unit is cached per resource path. If the contentId of the unit * changes, the old unit is discarded and replaced with the new unit. */ class MemoryUnitCache
[gwt-contrib] Re: Discards the jar file name in the resource location. It isn't necessary, and (issue1428805)
LGTM. Like Toby said, this is much better. Can you confirm that re-rooted resources retain their original (non-rerooted) path location? http://gwt-code-reviews.appspot.com/1428805/ -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Discards the jar file name in the resource location. It isn't necessary, and (issue1428805)
On 2011/05/03 18:45:15, scottb wrote: LGTM. Like Toby said, this is much better. Can you confirm that re-rooted resources retain their original (non-rerooted) path location? What do you mean by re-rooted resources? super sourced resources? One thing I looked at was that generated resources create their path from the type name, but I don't think they get re-rooted if what you mean that is items that have been super sourced. http://gwt-code-reviews.appspot.com/1428805/ -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Discards the jar file name in the resource location. It isn't necessary, and (issue1428805)
I mean only super-sourced. Does Object come through as 'com/google/gwt/emul/java/lang/Object.java' or merely 'java/lang/Object.java'? On Tue, May 3, 2011 at 2:56 PM, zun...@google.com wrote: On 2011/05/03 18:45:15, scottb wrote: LGTM. Like Toby said, this is much better. Can you confirm that re-rooted resources retain their original (non-rerooted) path location? What do you mean by re-rooted resources? super sourced resources? One thing I looked at was that generated resources create their path from the type name, but I don't think they get re-rooted if what you mean that is items that have been super sourced. http://gwt-code-reviews.appspot.com/1428805/ -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Allows enum ordinalization to proceed for enums with static methods/fields (issue1428808)
http://gwt-code-reviews.appspot.com/1428808/diff/1/dev/core/src/com/google/gwt/dev/jjs/impl/EnumOrdinalizer.java File dev/core/src/com/google/gwt/dev/jjs/impl/EnumOrdinalizer.java (right): http://gwt-code-reviews.appspot.com/1428808/diff/1/dev/core/src/com/google/gwt/dev/jjs/impl/EnumOrdinalizer.java#newcode439 dev/core/src/com/google/gwt/dev/jjs/impl/EnumOrdinalizer.java:439: * method, which then gets inlined. It's worth thinking about in the future that clever ordinalization *could* allow the VALUES to exist, it would just be an array of integers instead of objects. http://gwt-code-reviews.appspot.com/1428808/diff/1/dev/core/test/com/google/gwt/dev/jjs/impl/EnumOrdinalizerTest.java File dev/core/test/com/google/gwt/dev/jjs/impl/EnumOrdinalizerTest.java (left): http://gwt-code-reviews.appspot.com/1428808/diff/1/dev/core/test/com/google/gwt/dev/jjs/impl/EnumOrdinalizerTest.java#oldcode857 dev/core/test/com/google/gwt/dev/jjs/impl/EnumOrdinalizerTest.java:857: * a program. I assume this is TODONE now? http://gwt-code-reviews.appspot.com/1428808/diff/1/dev/core/test/com/google/gwt/dev/jjs/impl/EnumOrdinalizerTest.java File dev/core/test/com/google/gwt/dev/jjs/impl/EnumOrdinalizerTest.java (right): http://gwt-code-reviews.appspot.com/1428808/diff/1/dev/core/test/com/google/gwt/dev/jjs/impl/EnumOrdinalizerTest.java#newcode251 dev/core/test/com/google/gwt/dev/jjs/impl/EnumOrdinalizerTest.java:251: assertTrue(tracker.isOrdinalized(test.EntryPoint$Fruit)); Is Tracker only used for testing? If so, it looks like you could throw it away in a future change, since you can now query the JEnumType directly. http://gwt-code-reviews.appspot.com/1428808/diff/1/dev/core/test/com/google/gwt/dev/jjs/impl/EnumOrdinalizerTest.java#newcode273 dev/core/test/com/google/gwt/dev/jjs/impl/EnumOrdinalizerTest.java:273: String y = fruit.staticField;); Are you sure this *should* prevent ordinalization? Even if you turn off all optimizations, GenerateJavaScriptAST generates a comma expression here, like (fruit, Fruit_staticField). http://gwt-code-reviews.appspot.com/1428808/diff/1/dev/core/test/com/google/gwt/dev/jjs/impl/EnumOrdinalizerTest.java#newcode287 dev/core/test/com/google/gwt/dev/jjs/impl/EnumOrdinalizerTest.java:287: int y = fruit.staticMethod();); Same here. http://gwt-code-reviews.appspot.com/1428808/diff/1/dev/core/test/com/google/gwt/dev/jjs/impl/EnumOrdinalizerTest.java#newcode456 dev/core/test/com/google/gwt/dev/jjs/impl/EnumOrdinalizerTest.java:456: }); Is this a good test? The upcast to Object should have already blacklisted it, so I'm not sure you're testing instanceof. http://gwt-code-reviews.appspot.com/1428808/ -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Moved MobileWebApp src to src/main in preparation for an HTML5 App Cache linker (issue1430802)
Reviewers: rjrjr, Description: Moved MobileWebApp src to src/main in preparation for an HTML5 App Cache linker Please review this at http://gwt-code-reviews.appspot.com/1430802/ Affected files: D samples/mobilewebapp/src/META-INF/jdoconfig.xml D samples/mobilewebapp/src/META-INF/persistence.xml D samples/mobilewebapp/src/com/google/gwt/sample/mobilewebapp/FormFactor.gwt.xml D samples/mobilewebapp/src/com/google/gwt/sample/mobilewebapp/MobileWebApp.gwt.xml D samples/mobilewebapp/src/com/google/gwt/sample/mobilewebapp/client/ClientFactory.java D samples/mobilewebapp/src/com/google/gwt/sample/mobilewebapp/client/ClientFactoryImpl.java D samples/mobilewebapp/src/com/google/gwt/sample/mobilewebapp/client/ClientFactoryImplMobile.java D samples/mobilewebapp/src/com/google/gwt/sample/mobilewebapp/client/ClientFactoryImplTablet.java D samples/mobilewebapp/src/com/google/gwt/sample/mobilewebapp/client/MobileWebApp.java D samples/mobilewebapp/src/com/google/gwt/sample/mobilewebapp/client/MobileWebAppRequestFactory.java D samples/mobilewebapp/src/com/google/gwt/sample/mobilewebapp/client/MobileWebAppShell.java D samples/mobilewebapp/src/com/google/gwt/sample/mobilewebapp/client/MobileWebAppShellBase.java D samples/mobilewebapp/src/com/google/gwt/sample/mobilewebapp/client/TaskRequest.java D samples/mobilewebapp/src/com/google/gwt/sample/mobilewebapp/client/activity/AppActivityMapper.java D samples/mobilewebapp/src/com/google/gwt/sample/mobilewebapp/client/activity/TaskEditActivity.java D samples/mobilewebapp/src/com/google/gwt/sample/mobilewebapp/client/activity/TaskEditView.java D samples/mobilewebapp/src/com/google/gwt/sample/mobilewebapp/client/activity/TaskListActivity.java D samples/mobilewebapp/src/com/google/gwt/sample/mobilewebapp/client/activity/TaskListView.java D samples/mobilewebapp/src/com/google/gwt/sample/mobilewebapp/client/desktop/DesktopTaskEditView.java D samples/mobilewebapp/src/com/google/gwt/sample/mobilewebapp/client/desktop/DesktopTaskEditView.ui.xml D samples/mobilewebapp/src/com/google/gwt/sample/mobilewebapp/client/desktop/DesktopTaskListView.java D samples/mobilewebapp/src/com/google/gwt/sample/mobilewebapp/client/desktop/DesktopTaskListView.ui.xml D samples/mobilewebapp/src/com/google/gwt/sample/mobilewebapp/client/desktop/MainMenuCellList.css D samples/mobilewebapp/src/com/google/gwt/sample/mobilewebapp/client/desktop/MobileWebAppShellDesktop.java D samples/mobilewebapp/src/com/google/gwt/sample/mobilewebapp/client/desktop/MobileWebAppShellDesktop.ui.xml D samples/mobilewebapp/src/com/google/gwt/sample/mobilewebapp/client/desktop/PieChart.java D samples/mobilewebapp/src/com/google/gwt/sample/mobilewebapp/client/mobile/MobileCellList.css D samples/mobilewebapp/src/com/google/gwt/sample/mobilewebapp/client/mobile/MobileTaskEditView.java D samples/mobilewebapp/src/com/google/gwt/sample/mobilewebapp/client/mobile/MobileTaskEditView.ui.xml D samples/mobilewebapp/src/com/google/gwt/sample/mobilewebapp/client/mobile/MobileTaskListView.java D samples/mobilewebapp/src/com/google/gwt/sample/mobilewebapp/client/mobile/MobileTaskListView.ui.xml D samples/mobilewebapp/src/com/google/gwt/sample/mobilewebapp/client/mobile/MobileWebAppShellMobile.java D samples/mobilewebapp/src/com/google/gwt/sample/mobilewebapp/client/mobile/MobileWebAppShellMobile.ui.xml D samples/mobilewebapp/src/com/google/gwt/sample/mobilewebapp/client/mobile/TaskProxyCell.java D samples/mobilewebapp/src/com/google/gwt/sample/mobilewebapp/client/place/AppPlaceHistoryMapper.java D samples/mobilewebapp/src/com/google/gwt/sample/mobilewebapp/client/place/TaskEditPlace.java D samples/mobilewebapp/src/com/google/gwt/sample/mobilewebapp/client/place/TaskListPlace.java D samples/mobilewebapp/src/com/google/gwt/sample/mobilewebapp/client/tablet/MobileWebAppShellTablet.java D samples/mobilewebapp/src/com/google/gwt/sample/mobilewebapp/client/tablet/MobileWebAppShellTablet.ui.xml D samples/mobilewebapp/src/com/google/gwt/sample/mobilewebapp/client/tablet/TabletResources.java D samples/mobilewebapp/src/com/google/gwt/sample/mobilewebapp/client/tablet/TabletTaskEditView.java D samples/mobilewebapp/src/com/google/gwt/sample/mobilewebapp/client/tablet/TabletTaskEditView.ui.xml D samples/mobilewebapp/src/com/google/gwt/sample/mobilewebapp/client/tablet/tabletStyles.css D samples/mobilewebapp/src/com/google/gwt/sample/mobilewebapp/client/ui/DateButton.java D samples/mobilewebapp/src/com/google/gwt/sample/mobilewebapp/client/ui/EditorDecorator.java D samples/mobilewebapp/src/com/google/gwt/sample/mobilewebapp/client/ui/SoundEffects.java D samples/mobilewebapp/src/com/google/gwt/sample/mobilewebapp/server/domain/EMF.java D samples/mobilewebapp/src/com/google/gwt/sample/mobilewebapp/server/domain/Task.java D
[gwt-contrib] Re: Moved MobileWebApp src to src/main in preparation for an HTML5 App Cache linker (issue1430802)
LGTM http://gwt-code-reviews.appspot.com/1430802/ -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] [google-web-toolkit] r10131 committed - Add a convenience base class for value type locators...
Revision: 10131 Author: r...@google.com Date: Tue May 3 10:35:38 2011 Log: Add a convenience base class for value type locators Review at http://gwt-code-reviews.appspot.com/1428809 http://code.google.com/p/google-web-toolkit/source/detail?r=10131 Added: /trunk/user/src/com/google/web/bindery/requestfactory/shared/ValueLocator.java === --- /dev/null +++ /trunk/user/src/com/google/web/bindery/requestfactory/shared/ValueLocator.java Tue May 3 10:35:38 2011 @@ -0,0 +1,59 @@ +/* + * Copyright 2011 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.web.bindery.requestfactory.shared; + +/** + * A {@link Locator} for use with value types (as opposed to entities), which + * are not persisted. Abstract methods from the {@link Locator} class that are + * not relevant for value types are implemented to return {@code null}. + * + * @param T the type of domain object the Locator will operate on + */ +public abstract class ValueLocatorT extends LocatorT, Void { + + /** + * Returns {@code null}. + */ + @Override + public final ClassT getDomainType() { +return null; + } + + /** + * Returns {@code null}. + */ + @Override + public final Void getId(T domainObject) { +return null; + } + + /** + * Returns {@code null}. + */ + @Override + public final ClassVoid getIdType() { +return null; + } + + /** + * Returns {@code null}. + */ + @Override + public final Object getVersion(T domainObject) { +return null; + } +} -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Moved MobileWebApp src to src/main in preparation for an HTML5 App Cache linker (issue1430802)
Submitted as of r10132 http://gwt-code-reviews.appspot.com/1430802/ -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Adds HTML5 App Cache support to MobileWebApp sample. (issue1428811)
Reviewers: pdr, tobyr, cramsdale, Description: Adds HTML5 App Cache support to MobileWebApp sample. Uses a custom linker to figure out which files were generated by GWTC. Please review this at http://gwt-code-reviews.appspot.com/1428811/ Affected files: A dev/core/src/com/google/gwt/core/linker/SimpleAppCacheLinker.java A dev/core/test/com/google/gwt/core/linker/SimpleAppCacheLinkerTest.java A samples/mobilewebapp/src/dev/com/google/gwt/sample/mobilewebapp/linker/AppCacheLinker.java M samples/mobilewebapp/user-build.xml M samples/mobilewebapp/war/MobileWebApp.html M samples/mobilewebapp/war/WEB-INF/web.xml M user/test/com/google/gwt/core/ext/LinkerSuite.java -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Adds HTML5 App Cache support to MobileWebApp sample. (issue1422815)
Review will continue in http://gwt-code-reviews.appspot.com/1428811 This Issue is too hard to follow. http://gwt-code-reviews.appspot.com/1422815/diff/1/samples/mobilewebapp/src/dev/com/google/gwt/sample/mobilewebapp/linker/AppCacheLinker.java File samples/mobilewebapp/src/dev/com/google/gwt/sample/mobilewebapp/linker/AppCacheLinker.java (right): http://gwt-code-reviews.appspot.com/1422815/diff/1/samples/mobilewebapp/src/dev/com/google/gwt/sample/mobilewebapp/linker/AppCacheLinker.java#newcode57 samples/mobilewebapp/src/dev/com/google/gwt/sample/mobilewebapp/linker/AppCacheLinker.java:57: private static final String[] STATIC_FILES = { Moved this class into GWT proper and now the developer can simply extend this class and provide an array with additional files to include in the manifest. On 2011/05/02 16:38:20, pdr wrote: Is there no way to grab these automatically so that this static files stuff doesn't have to be here? At a minimum there should be a way to parameterize this. http://gwt-code-reviews.appspot.com/1422815/diff/1/samples/mobilewebapp/src/dev/com/google/gwt/sample/mobilewebapp/linker/AppCacheLinker.java#newcode58 samples/mobilewebapp/src/dev/com/google/gwt/sample/mobilewebapp/linker/AppCacheLinker.java:58: /MobileWebApp.html, On 2011/05/02 16:38:20, pdr wrote: I believe you don't need to list MobileWebApp.html in the cache manifest since it will automatically be cached. The css file will need to be listed though. True, but http://dev.w3.org/html5/spec/offline.html#offline actually encourages the writer to explicitly name the main html in the manifest. http://gwt-code-reviews.appspot.com/1422815/diff/1/samples/mobilewebapp/src/dev/com/google/gwt/sample/mobilewebapp/linker/AppCacheLinker.java#newcode59 samples/mobilewebapp/src/dev/com/google/gwt/sample/mobilewebapp/linker/AppCacheLinker.java:59: /MobileWebApp.css, On 2011/05/02 16:38:20, pdr wrote: These resources (in /audio/) can be included by adding a public path=path to get exported/ line to your gwt.xml so you don't have to list them here. It seems the use of public path is getting deprecated. http://gwt-code-reviews.appspot.com/1422815/ -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] 1. Assert, at runtime, that GWT is running in Standards Mode (i.e. with an appropriate DOCTYPE d... (issue1422816)
Reviewers: jlabanca, Description: 1. Assert, at runtime, that GWT is running in Standards Mode (i.e. with an appropriate DOCTYPE declaration), e.g !doctype html 2. Provide a new configuration property to indicate the required browser rendering mode, which can be used to suppress the above Standards Mode requirement, e.g. - Skip rendering mode tests set-configuration-property name=document.compatMode value=*/ - Require Standards Mode (the default) set-configuration-property name=document.compatMode value=CSS1Compat/ - Require Quirks Mode (for apps that require this and know what they are doing) set-configuration-property name=document.compatMode value=BackCompat/ 3. Modify the default HTML template to indicate that quirks mode is not supported Fixes issues: 6086, 6306 Please review this at http://gwt-code-reviews.appspot.com/1422816/ Affected files: M user/src/com/google/gwt/user/UserAgent.gwt.xml A user/src/com/google/gwt/user/client/DocumentModeAsserter.java A user/src/com/google/gwt/user/rebind/DocumentModeGenerator.java M user/src/com/google/gwt/user/tools/templates/sample/_warFolder_/_moduleShortName_.htmlsrc -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] [google-web-toolkit] r10133 committed - Tweak javadoc on LazyDomElement
Revision: 10133 Author: rj...@google.com Date: Tue May 3 12:27:48 2011 Log: Tweak javadoc on LazyDomElement http://code.google.com/p/google-web-toolkit/source/detail?r=10133 Modified: /trunk/user/src/com/google/gwt/uibinder/client/LazyDomElement.java === --- /trunk/user/src/com/google/gwt/uibinder/client/LazyDomElement.java Tue May 3 08:15:07 2011 +++ /trunk/user/src/com/google/gwt/uibinder/client/LazyDomElement.java Tue May 3 12:27:48 2011 @@ -24,19 +24,19 @@ * elements and delay calls to getElementById() to when the element is actually * used. But note that it will throw a RuntimeException in case the element is * accessed but not yet attached in the DOM tree. - * + * p * Usage example: - * + * p * bTemplate:/b * pre * lt;gwt:HTMLPanelgt; * lt;div ui:field=myDiv /gt; * lt;/gwt:HTMLPanelgt; * /pre - * + * p * bClass:/b * pre - * @UiField LazyDomElementlt;DivElementgt; myDiv; + * {@literal @}UiField LazyDomElementlt;DivElementgt; myDiv; * * public setText(String text) { * myDiv.get().setInnerHtml(text); -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Update the flute jar to accept double colon notation in css selectors, rename (issue1431801)
Reviewers: cromwellian, Description: Update the flute jar to accept double colon notation in css selectors, rename it to version 2, and use it throughout gwt. Also update the AST generation code to output double colons for any pseudo class/element that was is not supported with the single colon notation. Please review this at http://gwt-code-reviews.appspot.com/1431801/ Affected files: M common.ant.xml M dev/build.xml M eclipse/servlet/.classpath M eclipse/user/.classpath M user/build.xml M user/src/com/google/gwt/resources/css/GenerateCssAst.java Index: common.ant.xml === --- common.ant.xml (revision 10132) +++ common.ant.xml (working copy) @@ -236,7 +236,7 @@ pathelement location=${gwt.tools.lib}/junit/junit-4.8.2.jar / pathelement location=${gwt.tools.lib}/selenium/selenium-java-client-driver.jar / pathelement location=${gwt.tools.lib}/w3c/sac/sac-1.3.jar / - pathelement location=${gwt.tools.lib}/w3c/flute/flute-1.3-gg1.jar / + pathelement location=${gwt.tools.lib}/w3c/flute/flute-1.3-gg2.jar / extraclasspaths / /classpath Index: dev/build.xml === --- dev/build.xml (revision 10132) +++ dev/build.xml (working copy) @@ -39,7 +39,7 @@ pathelement location=${gwt.tools.lib}/jfreechart/jfreechart-1.0.3.jar / pathelement location=${gwt.tools.lib}/selenium/selenium-java-client-driver.jar / pathelement location=${gwt.tools.lib}/w3c/sac/sac-1.3.jar / -pathelement location=${gwt.tools.lib}/w3c/flute/flute-1.3-gg1.jar / +pathelement location=${gwt.tools.lib}/w3c/flute/flute-1.3-gg2.jar / pathelement location=${gwt.tools}/redist/json/r2_20080312/json-1.5.jar / pathelement location=${gwt.tools.lib}/hibernate/validator/hibernate-validator-4.1.0.Final.jar / pathelement location=${gwt.tools.lib}/javax/validation/validation-api-1.0.0.GA.jar / Index: eclipse/servlet/.classpath === --- eclipse/servlet/.classpath (revision 10132) +++ eclipse/servlet/.classpath (working copy) @@ -6,7 +6,7 @@ classpathentry kind=var path=GWT_TOOLS/lib/tomcat/servlet-api-2.4.jar/ classpathentry combineaccessrules=false kind=src path=/gwt-user/ classpathentry combineaccessrules=false kind=src path=/gwt-dev/ - classpathentry kind=var path=GWT_TOOLS/lib/w3c/flute/flute-1.3-gg1.jar/ + classpathentry kind=var path=GWT_TOOLS/lib/w3c/flute/flute-1.3-gg2.jar/ classpathentry kind=var path=GWT_TOOLS/lib/w3c/sac/sac-1.3.jar/ classpathentry kind=output path=bin/ /classpath Index: eclipse/user/.classpath === --- eclipse/user/.classpath (revision 10132) +++ eclipse/user/.classpath (working copy) @@ -27,7 +27,7 @@ classpathentry kind=var path=GWT_TOOLS/lib/xerces/xerces-2_9_1/xercesImpl-NoMetaInf.jar/ classpathentry kind=var path=GWT_TOOLS/lib/xerces/xerces-2_9_1/xml-apis.jar/ classpathentry kind=var path=GWT_TOOLS/lib/w3c/sac/sac-1.3.jar/ - classpathentry kind=var path=GWT_TOOLS/lib/w3c/flute/flute-1.3-gg1.jar/ + classpathentry kind=var path=GWT_TOOLS/lib/w3c/flute/flute-1.3-gg2.jar/ classpathentry kind=var path=GWT_TOOLS/lib/cglib/cglib-2.2.jar/ classpathentry kind=var path=GWT_TOOLS/lib/objenesis/objenesis-1.2.jar/ classpathentry kind=var path=GWT_TOOLS/lib/easymock/easymock-3.0.jar/ Index: user/build.xml === --- user/build.xml (revision 10132) +++ user/build.xml (working copy) @@ -98,7 +98,7 @@ pathelement location=${gwt.tools.lib}/jfreechart/jfreechart-1.0.3.jar / pathelement location=${gwt.tools.lib}/selenium/selenium-java-client-driver.jar / pathelement location=${gwt.tools.lib}/w3c/sac/sac-1.3.jar / -pathelement location=${gwt.tools.lib}/w3c/flute/flute-1.3-gg1.jar / +pathelement location=${gwt.tools.lib}/w3c/flute/flute-1.3-gg2.jar / pathelement location=${gwt.tools}/redist/json/r2_20080312/json-1.5.jar / pathelement location=${gwt.tools.lib}/javax/validation/validation-api-1.0.0.GA.jar / !-- The source is included so validation is available from client code -- @@ -150,7 +150,7 @@ fileset dir=${javac.out} / zipfileset src=${gwt.tools.lib}/tomcat/servlet-api-2.5.jar excludes=**/*.java/ zipfileset src=${gwt.tools.lib}/w3c/sac/sac-1.3.jar / - zipfileset src=${gwt.tools.lib}/w3c/flute/flute-1.3-gg1.jar / + zipfileset src=${gwt.tools.lib}/w3c/flute/flute-1.3-gg2.jar / /gwt.jar /target Index: user/src/com/google/gwt/resources/css/GenerateCssAst.java
[gwt-contrib] Re : Update the flute jar to accept double colon notation in css selectors, rename (issue1431801)
Rietveld is down atm (giving 500 errors) so i'll comment here: Le mercredi 4 mai 2011 02:21:56 UTC+2, unnurg a écrit : Index: user/src/com/google/gwt/resources/css/GenerateCssAst.java === --- user/src/com/google/gwt/resources/css/GenerateCssAst.java (revision 10132) +++ user/src/com/google/gwt/resources/css/GenerateCssAst.java (working copy) @@ -92,6 +92,10 @@ @SuppressWarnings(unused) public class GenerateCssAst { + private static ListString validPseudoClasses = Arrays.asList( +link, visited, active, hover, focus, first-letter, first-line, +first-child, before, after); + There are a number of pseudo classes not covered here: http://www.w3.org/TR/css3-selectors/#pseudo-classes Those would all be treated as pseudo elements instead (using the :: notation) and could very well fail in browsers (not tested though), because only one pseudo-element may appear per selector http://www.w3.org/TR/css3-selectors/#pseudo-elements The real fix would be to distinguish pseudo classes and pseudo-elements at parse time and emit them the same as what they were parsed from; but this probably means updating SAC. (btw, there are a bunch CSS3 selectors I would have liked to use with CssResource and couldn't because the parser only understands CSS2, namely :nth-child(-n+4) and :not([someattribute]), so maybe Flute/SAC/whatever should instead be updated to allow roundtripping unknown constructs, rather than discarding them) /** * Maps SAC CSSParseExceptions into a TreeLogger. All parsing errors will be * recorded in a single TreeLogger branch, which will be created only if a @@ -937,7 +941,11 @@ case Condition.SAC_CLASS_CONDITION: return . + c.getValue(); case Condition.SAC_PSEUDO_CLASS_CONDITION: - return : + c.getValue(); + if (validPseudoClasses.contains(c.getValue().toLowerCase())) { +return : + c.getValue(); + } else { +return :: + c.getValue(); + } } } else if (condition instanceof CombinatorCondition) { Beware of the turkish bug with toLowerCase/toUpperCase, you should use toLowerCase(Locale.ENGLISH) (see the javadoc for the rationale) -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Re : Update the flute jar to accept double colon notation in css selectors, rename (issue1431801)
Hi Thomas - We considered the more comprehensive fixes (updating SAC, as well as fully updating the entire tree to better understand CSS3) and decided that we don't have the resources to do so at this time. So right now, we're looking to do the bare minimum fix that would allow people to use syntax like foo::-webkit-scroll without breaking existing users. You're right about the new pseudo classes though - although only CSS 2 is officially supported, using something like foo:enabled is probably working for people right now and will probably break with this change. Ray and I just discussed another potential hack that should keep the : or :: without patching SAC - will send the updated patch in a little bit. Thanks for the catch! - Unnur On Tue, May 3, 2011 at 5:55 PM, Thomas Broyer t.bro...@gmail.com wrote: Rietveld is down atm (giving 500 errors) so i'll comment here: Le mercredi 4 mai 2011 02:21:56 UTC+2, unnurg a écrit : Index: user/src/com/google/gwt/resources/css/GenerateCssAst.java === --- user/src/com/google/gwt/resources/css/GenerateCssAst.java (revision 10132) +++ user/src/com/google/gwt/resources/css/GenerateCssAst.java (working copy) @@ -92,6 +92,10 @@ @SuppressWarnings(unused) public class GenerateCssAst { + private static ListString validPseudoClasses = Arrays.asList( +link, visited, active, hover, focus, first-letter, first-line, +first-child, before, after); + There are a number of pseudo classes not covered here: http://www.w3.org/TR/css3-selectors/#pseudo-classes Those would all be treated as pseudo elements instead (using the :: notation) and could very well fail in browsers (not tested though), because only one pseudo-element may appear per selector http://www.w3.org/TR/css3-selectors/#pseudo-elements The real fix would be to distinguish pseudo classes and pseudo-elements at parse time and emit them the same as what they were parsed from; but this probably means updating SAC. (btw, there are a bunch CSS3 selectors I would have liked to use with CssResource and couldn't because the parser only understands CSS2, namely :nth-child(-n+4) and :not([someattribute]), so maybe Flute/SAC/whatever should instead be updated to allow roundtripping unknown constructs, rather than discarding them) /** * Maps SAC CSSParseExceptions into a TreeLogger. All parsing errors will be * recorded in a single TreeLogger branch, which will be created only if a @@ -937,7 +941,11 @@ case Condition.SAC_CLASS_CONDITION: return . + c.getValue(); case Condition.SAC_PSEUDO_CLASS_CONDITION: - return : + c.getValue(); + if (validPseudoClasses.contains(c.getValue().toLowerCase())) { +return : + c.getValue(); + } else { +return :: + c.getValue(); + } } } else if (condition instanceof CombinatorCondition) { Beware of the turkish bug with toLowerCase/toUpperCase, you should use toLowerCase(Locale.ENGLISH) (see the javadoc for the rationale) -- DO NOT FORWARD -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Update the flute jar to accept double colon notation in css selectors, rename (issue1431801)
http://gwt-code-reviews.appspot.com/1431801/ -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Update the flute jar to accept double colon notation in css selectors, rename (issue1431801)
http://gwt-code-reviews.appspot.com/1431801/ -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Allows enum ordinalization to proceed for enums with static methods/fields (issue1428808)
http://gwt-code-reviews.appspot.com/1428808/ -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Allows enum ordinalization to proceed for enums with static methods/fields (issue1428808)
I agree there are more opportunities for ordinalization here, as suggested by Scott (e.g. allow references to $VALUES, or to static fields/methods on enum instances. I can pursue those further in a follow-on release. http://gwt-code-reviews.appspot.com/1428808/diff/1/dev/core/src/com/google/gwt/dev/jjs/impl/EnumOrdinalizer.java File dev/core/src/com/google/gwt/dev/jjs/impl/EnumOrdinalizer.java (right): http://gwt-code-reviews.appspot.com/1428808/diff/1/dev/core/src/com/google/gwt/dev/jjs/impl/EnumOrdinalizer.java#newcode439 dev/core/src/com/google/gwt/dev/jjs/impl/EnumOrdinalizer.java:439: * method, which then gets inlined. In this case, black-listing references to VALUES is the mechanism for detecting calls to the values() method, which might have been inlined. But I guess you are suggesting we could allow calls to the values() method, and thus keep the $VALUES array around. I'll ponder as a future thing, I can see it could be useful (possibly in the rpc deserializers for enums). It would require changing how we modify the clinit as well during ordinalization. http://gwt-code-reviews.appspot.com/1428808/diff/1/dev/core/test/com/google/gwt/dev/jjs/impl/EnumOrdinalizerTest.java File dev/core/test/com/google/gwt/dev/jjs/impl/EnumOrdinalizerTest.java (left): http://gwt-code-reviews.appspot.com/1428808/diff/1/dev/core/test/com/google/gwt/dev/jjs/impl/EnumOrdinalizerTest.java#oldcode857 dev/core/test/com/google/gwt/dev/jjs/impl/EnumOrdinalizerTest.java:857: * a program. Yes, actually it is now, and I'm not sure what changed the behavior, but programs with single enums, at least within this test framework, do allow ordinalization. I suspect it could be due to changes in JavaAstConstructor.java (more accurate usage of jsni methods, which prevent some inlining in the java AST). http://gwt-code-reviews.appspot.com/1428808/diff/1/dev/core/test/com/google/gwt/dev/jjs/impl/EnumOrdinalizerTest.java File dev/core/test/com/google/gwt/dev/jjs/impl/EnumOrdinalizerTest.java (right): http://gwt-code-reviews.appspot.com/1428808/diff/1/dev/core/test/com/google/gwt/dev/jjs/impl/EnumOrdinalizerTest.java#newcode251 dev/core/test/com/google/gwt/dev/jjs/impl/EnumOrdinalizerTest.java:251: assertTrue(tracker.isOrdinalized(test.EntryPoint$Fruit)); Tracker also keeps track of stats for ordinalization, and allows a report to be generated at the end of a compile with an optional (currently undocumented) flag. It keeps track of which optimization passes resulted in which ordinalizations, keeps track of which sourceInfo line number caused an enum to be black-listed. And the overall stats for how many enums are in the app. Going forward, the idea is to have the tracker data generated as part of the soyc report. I think of it as a model for what can be done to provide greater visibility into other optimizers as well. http://gwt-code-reviews.appspot.com/1428808/diff/1/dev/core/test/com/google/gwt/dev/jjs/impl/EnumOrdinalizerTest.java#newcode273 dev/core/test/com/google/gwt/dev/jjs/impl/EnumOrdinalizerTest.java:273: String y = fruit.staticField;); Interesting, I guess if fruit is null (or could be null), then ordinalization would have been blocked anyway (and I think the possibility that fruit is null is the only semantic difference from the Fruit.staticField case). So ordinalization could proceed in this case, it would require code to convert fruit.staticField to Fruit.staticField, as part of the ordinalization process. http://gwt-code-reviews.appspot.com/1428808/diff/1/dev/core/test/com/google/gwt/dev/jjs/impl/EnumOrdinalizerTest.java#newcode287 dev/core/test/com/google/gwt/dev/jjs/impl/EnumOrdinalizerTest.java:287: int y = fruit.staticMethod();); yep http://gwt-code-reviews.appspot.com/1428808/diff/1/dev/core/test/com/google/gwt/dev/jjs/impl/EnumOrdinalizerTest.java#newcode456 dev/core/test/com/google/gwt/dev/jjs/impl/EnumOrdinalizerTest.java:456: }); good catch, I've updated the test for this. http://gwt-code-reviews.appspot.com/1428808/ -- http://groups.google.com/group/Google-Web-Toolkit-Contributors