var j;
for(j in $wnd.vaadin.vaadinConfigurations) {
if(!$wnd.vaadin.vaadinConfigurations[j].initialized) {
+ // $entry not needed as function is not exported
list.@java.util.Collection::add(Ljava/lang/Object;)(j);
}
}
for(var i = 0; i < sheets.length; i++) {
var sheet = sheets[i];
if(sheet.href && sheet.href.indexOf("VAADIN/themes")>-1) {
+ // $entry not needed as function is not exported
this.@com.vaadin.terminal.gwt.client.CSSRule::rules = @com.vaadin.terminal.gwt.client.CSSRule::searchForRule(Lcom/google/gwt/core/client/JavaScriptObject;Ljava/lang/String;Z)(sheet, selector, deep);
return;
}
// IE handles imported sheet differently
if(deep && sheet.imports && sheet.imports.length > 0) {
for(var i=0; i < sheet.imports.length; i++) {
+ // $entry not needed as function is not exported
var imports = @com.vaadin.terminal.gwt.client.CSSRule::searchForRule(Lcom/google/gwt/core/client/JavaScriptObject;Ljava/lang/String;Z)(sheet.imports[i], selector, deep);
allMatches.concat(imports);
}
}
} else if(deep && r.type == 3) {
// Search @import stylesheet
+ // $entry not needed as function is not exported
var imports = @com.vaadin.terminal.gwt.client.CSSRule::searchForRule(Lcom/google/gwt/core/client/JavaScriptObject;Ljava/lang/String;Z)(r.styleSheet, selector, deep);
allMatches = allMatches.concat(imports);
}
/*-{
var j = this.@com.vaadin.terminal.gwt.client.CSSRule::rules.length;
for(var i=0; i<j; i++) {
+ // $entry not needed as function is not exported
var value = this.@com.vaadin.terminal.gwt.client.CSSRule::rules[i].style[propertyName];
if(value)
return value;
private final native void fillWithValues(Collection<ComponentDetail> list)
/*-{
for(var key in this) {
+ // $entry not needed as function is not exported
list.@java.util.Collection::add(Ljava/lang/Object;)(this[key]);
}
}-*/;
if (isNaN(number))
return null;
else
+ // $entry not needed as function is not exported
return @java.lang.Integer::valueOf(I)(number);
}-*/;
// Assume an empty token.
var token = '';
// Get the initial token from the url's hash component.
+ // $entry not needed as function is not exported
var hash = @com.vaadin.terminal.gwt.client.HistoryImplIEVaadin::getLocationHash()();
if (hash.length > 0) {
try {
protected native void navigateFrame(String token)
/*-{
+ // $entry not needed as function is not exported
var escaped = @com.vaadin.terminal.gwt.client.HistoryImplIEVaadin::escapeHtml(Ljava/lang/String;)(token);
var doc = this.@com.vaadin.terminal.gwt.client.HistoryImplIEVaadin::historyFrame.contentWindow.document;
doc.open();
protected native void updateHash(String token)
/*-{
+ // $entry not needed as function is not exported
$wnd.location.hash = this.@com.google.gwt.user.client.impl.HistoryImpl::encodeFragment(Ljava/lang/String;)(token);
}-*/;
var historyImplRef = this;
var urlChecker = function() {
$wnd.setTimeout(urlChecker, 250);
+ // $entry not needed as function is not exported
var hash = @com.vaadin.terminal.gwt.client.HistoryImplIEVaadin::getLocationHash()();
if (hash.length > 0) {
var token = '';
/*-{
var j;
for(j in $wnd.vaadin.vaadinConfigurations) {
+ // $entry not needed as function is not exported
list.@java.util.Collection::add(Ljava/lang/Object;)(j);
}
}-*/;
import java.io.IOException;
import java.util.HashSet;
import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import junit.framework.Assert;
import junit.framework.TestCase;
}
}
+ public void testGwtFilesUsingEntry() {
+ Set<String> ignore = new HashSet<String>(alwaysIgnore);
+ ignore.add(externalJavaFiles);
+ validateFiles(
+ SRC_DIR,
+ new GwtEntryChecker(),
+ ignore,
+ "The following files might export javscript callbacks without $entry:\n{0}",
+ ".java");
+ }
+
public interface FileValidator {
void validateFile(File f) throws Exception;
}
}
}
}
+
+ class GwtEntryChecker extends FileContentsValidator {
+ // Matches e.g.
+ // @com.vaadin.terminal.gwt.client.HistoryImplIEVaadin::escapeHtml(
+ private final Matcher matcher = Pattern.compile("@[\\w.]+::\\w+\\(")
+ .matcher("");
+
+ @Override
+ protected void validateContents(File f, String contents)
+ throws Exception {
+ matcher.reset(contents);
+ while (matcher.find()) {
+ int start = matcher.start();
+
+ // Search backwards to find index of native block start
+ int nativeBlockStart = contents.lastIndexOf("/*-{", start);
+
+ // Get contents between block start and our match
+ String beforeMatchInBlock = contents.substring(
+ nativeBlockStart, start);
+
+ // Fail if there's no $entry
+ if (!beforeMatchInBlock.contains("$entry")) {
+ throw new IllegalArgumentException();
+ }
+ }
+ }
+
+ }
}