Skip to content

Instantly share code, notes, and snippets.

@niloc132
Created May 23, 2012 16:46
Show Gist options
  • Save niloc132/2776301 to your computer and use it in GitHub Desktop.
Save niloc132/2776301 to your computer and use it in GitHub Desktop.
Possible GWT compiler/j.l.String bug
function init(){
var runtimeValue, test, matchObj;
!!$stats && onModuleStart('com.google.gwt.user.client.UserAgentAsserter');
runtimeValue = $getRuntimeValue();
$equals('gecko1_8', runtimeValue) || ($wnd.alert('ERROR: Possible problem with your *.gwt.xml module file.\nThe compile time user.agent value (gecko1_8) does not match the runtime user.agent value (' + runtimeValue + '). Expect more errors.\n') , undefined);
!!$stats && onModuleStart('com.google.gwt.user.client.DocumentModeAsserter');
$onModuleLoad_0();
!!$stats && onModuleStart('com.google.gwt.logging.client.LogConfiguration');
$onModuleLoad($clinit_LogConfiguration());
!!$stats && onModuleStart('com.example.client.Test');
test = $wnd.prompt('value?', '12');
alert_0((matchObj = (new RegExp('([0-9]|[0-5][0-9])')).exec(test) , matchObj == null?false:test == matchObj[0]) + '');
alert_0($test(new RegExp('([0-9]|[0-5][0-9])'), test) + '');
}
function $test(this$static, input){
return this$static.test(input);
}
package com.example.client;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.regexp.shared.RegExp;
import com.google.gwt.user.client.Window;
public class Test implements EntryPoint {
private static final String REGEX = "([0-9]|[0-5][0-9])";
@Override
public void onModuleLoad() {
String test = Window.prompt("value?", "12");
Window.alert(test.matches(REGEX) + "");
Window.alert(RegExp.compile(REGEX).test(test) + "");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment