summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java1
-rw-r--r--src/com/vaadin/terminal/gwt/client/CSSRule.java4
-rw-r--r--src/com/vaadin/terminal/gwt/client/ComponentDetailMap.java1
-rw-r--r--src/com/vaadin/terminal/gwt/client/ComputedStyle.java1
-rw-r--r--src/com/vaadin/terminal/gwt/client/HistoryImplIEVaadin.java4
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VView.java1
-rw-r--r--tests/server-side/com/vaadin/tests/server/SourceFileChecker.java42
7 files changed, 54 insertions, 0 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java b/src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java
index a60fb808a1..21ecfe2776 100644
--- a/src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java
+++ b/src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java
@@ -270,6 +270,7 @@ public class ApplicationConfiguration implements EntryPoint {
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);
}
}
diff --git a/src/com/vaadin/terminal/gwt/client/CSSRule.java b/src/com/vaadin/terminal/gwt/client/CSSRule.java
index 4d9196c8d6..c36b0611e8 100644
--- a/src/com/vaadin/terminal/gwt/client/CSSRule.java
+++ b/src/com/vaadin/terminal/gwt/client/CSSRule.java
@@ -33,6 +33,7 @@ public class CSSRule {
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;
}
@@ -58,6 +59,7 @@ public class CSSRule {
// 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);
}
@@ -83,6 +85,7 @@ public class CSSRule {
}
} 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);
}
@@ -102,6 +105,7 @@ public class CSSRule {
/*-{
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;
diff --git a/src/com/vaadin/terminal/gwt/client/ComponentDetailMap.java b/src/com/vaadin/terminal/gwt/client/ComponentDetailMap.java
index 3405d838a7..dfbcf9d38b 100644
--- a/src/com/vaadin/terminal/gwt/client/ComponentDetailMap.java
+++ b/src/com/vaadin/terminal/gwt/client/ComponentDetailMap.java
@@ -62,6 +62,7 @@ final class ComponentDetailMap extends JavaScriptObject {
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]);
}
}-*/;
diff --git a/src/com/vaadin/terminal/gwt/client/ComputedStyle.java b/src/com/vaadin/terminal/gwt/client/ComputedStyle.java
index e994e47d63..4db3db2adf 100644
--- a/src/com/vaadin/terminal/gwt/client/ComputedStyle.java
+++ b/src/com/vaadin/terminal/gwt/client/ComputedStyle.java
@@ -179,6 +179,7 @@ public class ComputedStyle {
if (isNaN(number))
return null;
else
+ // $entry not needed as function is not exported
return @java.lang.Integer::valueOf(I)(number);
}-*/;
diff --git a/src/com/vaadin/terminal/gwt/client/HistoryImplIEVaadin.java b/src/com/vaadin/terminal/gwt/client/HistoryImplIEVaadin.java
index 0571959339..2e55b4d115 100644
--- a/src/com/vaadin/terminal/gwt/client/HistoryImplIEVaadin.java
+++ b/src/com/vaadin/terminal/gwt/client/HistoryImplIEVaadin.java
@@ -123,6 +123,7 @@ public class HistoryImplIEVaadin extends HistoryImpl {
// 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 {
@@ -146,6 +147,7 @@ public class HistoryImplIEVaadin extends HistoryImpl {
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();
@@ -155,6 +157,7 @@ public class HistoryImplIEVaadin extends HistoryImpl {
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);
}-*/;
@@ -169,6 +172,7 @@ public class HistoryImplIEVaadin extends HistoryImpl {
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 = '';
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VView.java b/src/com/vaadin/terminal/gwt/client/ui/VView.java
index 07ade6a8b1..c03652f259 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VView.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VView.java
@@ -657,6 +657,7 @@ public class VView extends SimplePanel implements Container, ResizeHandler,
/*-{
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);
}
}-*/;
diff --git a/tests/server-side/com/vaadin/tests/server/SourceFileChecker.java b/tests/server-side/com/vaadin/tests/server/SourceFileChecker.java
index 453aab5af8..9906990165 100644
--- a/tests/server-side/com/vaadin/tests/server/SourceFileChecker.java
+++ b/tests/server-side/com/vaadin/tests/server/SourceFileChecker.java
@@ -5,6 +5,8 @@ import java.io.FileInputStream;
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;
@@ -81,6 +83,17 @@ public class SourceFileChecker extends 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;
}
@@ -171,4 +184,33 @@ public class SourceFileChecker extends TestCase {
}
}
}
+
+ 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();
+ }
+ }
+ }
+
+ }
}