@@ -629,7 +629,7 @@ public class GQuery implements Lazy<GQuery, LazyGQuery> { | |||
*/ | |||
@SuppressWarnings("unchecked") | |||
public static <T> T[] grep(T[] objects, Predicate f) { | |||
ArrayList<Object> ret = new ArrayList<Object>(); | |||
ArrayList<Object> ret = new ArrayList<>(); | |||
for (int i = 0, l = objects.length; i < l; i++) { | |||
if (f.f(objects[i], i)) { | |||
ret.add(objects[i]); | |||
@@ -2888,7 +2888,7 @@ public class GQuery implements Lazy<GQuery, LazyGQuery> { | |||
* the array. | |||
*/ | |||
public <W> List<W> map(Function f) { | |||
ArrayList<W> ret = new ArrayList<W>(); | |||
ArrayList<W> ret = new ArrayList<>(); | |||
int i = 0; | |||
for (Element e : elements) { | |||
@SuppressWarnings("unchecked") | |||
@@ -3957,7 +3957,7 @@ public class GQuery implements Lazy<GQuery, LazyGQuery> { | |||
// more than one element) | |||
boolean mustBeCloned = length() == 1 && parents().filter("body").length() == 0; | |||
List<Element> newElements = new ArrayList<Element>(); | |||
List<Element> newElements = new ArrayList<>(); | |||
for (int i = 0, l = target.size(); i < l; i++) { | |||
GQuery that = (i > 0 && mustBeCloned) ? this.clone() : this; | |||
$(target.get(i)).replaceWith(that); | |||
@@ -4835,7 +4835,7 @@ public class GQuery implements Lazy<GQuery, LazyGQuery> { | |||
* return the list of attached widgets matching the query. | |||
*/ | |||
public List<Widget> widgets() { | |||
List<Widget> widgets = new ArrayList<Widget>(); | |||
List<Widget> widgets = new ArrayList<>(); | |||
for (Element e : elements) { | |||
Widget w = getAssociatedWidget(e); | |||
if (w != null) { | |||
@@ -4854,7 +4854,7 @@ public class GQuery implements Lazy<GQuery, LazyGQuery> { | |||
*/ | |||
@SuppressWarnings("unchecked") | |||
public <W extends Widget> List<W> widgets(Class<W> clazz) { | |||
List<W> ret = new ArrayList<W>(); | |||
List<W> ret = new ArrayList<>(); | |||
for (Widget w : widgets()) { | |||
// isAssignableFrom does not work in gwt. | |||
Class<?> c = w.getClass(); |
@@ -177,8 +177,8 @@ public class SelectorEngine implements HasSelector { | |||
return res; | |||
} | |||
Element ghostParent = null; | |||
HashSet<Node> parents = new HashSet<Node>(); | |||
HashSet<Node> elmList = new HashSet<Node>(); | |||
HashSet<Node> parents = new HashSet<>(); | |||
HashSet<Node> elmList = new HashSet<>(); | |||
for (int i = 0, l = nodes.getLength(); i < l; i++) { | |||
Node e = nodes.getItem(i); | |||
if (e == window || e == document || e.getNodeName() == null |
@@ -195,7 +195,7 @@ public class SelectorEngineCssToXPath extends SelectorEngineImpl { | |||
ReplaceCallback callback = (ReplaceCallback) o; | |||
while (p.test(s)) { | |||
MatchResult a = p.exec(s); | |||
ArrayList<String> args = new ArrayList<String>(); | |||
ArrayList<String> args = new ArrayList<>(); | |||
for (int i = 0; a != null && i < a.getGroupCount(); i++) { | |||
args.add(a.getGroup(i)); | |||
} | |||
@@ -220,7 +220,7 @@ public class SelectorEngineCssToXPath extends SelectorEngineImpl { | |||
ReplaceCallback callback = (ReplaceCallback) o; | |||
com.google.gwt.regexp.shared.MatchResult a = null; | |||
while ((a = p.exec(s)) != null) { | |||
ArrayList<String> args = new ArrayList<String>(); | |||
ArrayList<String> args = new ArrayList<>(); | |||
for (int i = 0; i < a.getGroupCount(); i++) { | |||
args.add(a.getGroup(i)); | |||
} |
@@ -497,7 +497,7 @@ public class SelectorEngineJS extends SelectorEngineImpl { | |||
for (int q = 0, qlen = previousMatch.size(); q < qlen; q++) { | |||
previous = previousMatch.getNode(q); | |||
if (!isAdded(previous)) { | |||
if (((Element) previous).getInnerText().indexOf(pseudoValue) != -1) { | |||
if (((Element) previous).getInnerText().contains(pseudoValue)) { | |||
setAdded(previous, true); | |||
matchingElms.addNode(previous); | |||
} |
@@ -168,7 +168,7 @@ public class JsCache extends JavaScriptObject { | |||
public final JsCache put(Object id, Object obj) { | |||
if (obj instanceof Boolean) { | |||
putBoolean(id, ((Boolean) obj).booleanValue()); | |||
putBoolean(id, (Boolean) obj); | |||
} else if (obj instanceof Number) { | |||
putNumber(id, ((Number) obj).doubleValue()); | |||
} else { |
@@ -40,7 +40,7 @@ public final class JsObjectArray<T> extends JavaScriptObject { | |||
if (t instanceof Number) { | |||
c().putNumber(length(), (((Number) t).doubleValue())); | |||
} else if (t instanceof Boolean) { | |||
c().putBoolean(length(), ((Boolean) t).booleanValue()); | |||
c().putBoolean(length(), (Boolean) t); | |||
} else { | |||
c().put(length(), t); | |||
} |
@@ -388,7 +388,7 @@ public class QueuePlugin<T extends QueuePlugin<?>> extends GQuery { | |||
if (f != null) { | |||
if (f instanceof Function) { | |||
// pass jumpToEnd to Animation.onCancel() via the element's data object | |||
$(elem).data(JUMP_TO_END, Boolean.valueOf(jumpToEnd)); | |||
$(elem).data(JUMP_TO_END, jumpToEnd); | |||
((Function) f).cancel(elem); | |||
$(elem).removeData(JUMP_TO_END); | |||
} |
@@ -69,7 +69,7 @@ public class Widgets extends QueuePlugin<Widgets> { | |||
*/ | |||
public <W extends Widget> Widgets widgets(WidgetFactory<W> factory, | |||
WidgetInitializer<W> initializers) { | |||
List<Element> result = new ArrayList<Element>(); | |||
List<Element> result = new ArrayList<>(); | |||
for (Element e : elements()) { | |||
W w = widget(e, factory, initializers); | |||
if (w != null) { |
@@ -35,7 +35,7 @@ public class Callbacks { | |||
boolean f(Object... objects); | |||
} | |||
private List<Object> stack = new ArrayList<Object>(); | |||
private List<Object> stack = new ArrayList<>(); | |||
private boolean done = false; | |||
@@ -113,7 +113,7 @@ public class Callbacks { | |||
if (!done) { | |||
done = isOnce; | |||
if (isMemory) { | |||
memory = new ArrayList<Object>(Arrays.asList(o)); | |||
memory = new ArrayList<>(Arrays.asList(o)); | |||
} | |||
if (stack != null) | |||
for (Object c : stack) { |
@@ -69,7 +69,7 @@ public class Transform { | |||
private static final RegExp anglePropRegex = RegExp.compile("(rotate[XYZ]?|skew[XY]?)"); | |||
private static final RegExp translatePropRegex = RegExp.compile("translate[XYZ]"); | |||
private HashMap<String, List<String>> map = new HashMap<String, List<String>>(); | |||
private HashMap<String, List<String>> map = new HashMap<>(); | |||
// Some browsers like HTMLUnit only support 2d transformations | |||
private static boolean supportsTransform3d() { | |||
@@ -234,4 +234,4 @@ public class Transform { | |||
private List<String> unit(String val, String unit) { | |||
return Arrays.asList(val + (val.endsWith(unit) ? "" : unit)); | |||
} | |||
} | |||
} |
@@ -128,7 +128,7 @@ public class Transitions extends Effects { | |||
} | |||
public static List<String> filterTransitionPropertyNames(Properties p) { | |||
List<String> ret = new ArrayList<String>(); | |||
List<String> ret = new ArrayList<>(); | |||
for (String s : p.keys()) { | |||
if (invalidTransitionNamesRegex.test(s)) { | |||
continue; |
@@ -83,7 +83,7 @@ public class EventsListener implements EventListener { | |||
} | |||
public static List<EventName> split(String events) { | |||
List<EventName> ret = new ArrayList<EventName>(); | |||
List<EventName> ret = new ArrayList<>(); | |||
String[] parts = events.split("[\\s,]+"); | |||
for (String event : parts) { | |||
String[] tmp = event.split("\\.", 2); | |||
@@ -229,7 +229,7 @@ public class EventsListener implements EventListener { | |||
} | |||
// Compute the live selectors which respond to this event type | |||
List<String> validSelectors = new ArrayList<String>(); | |||
List<String> validSelectors = new ArrayList<>(); | |||
for (String cssSelector : bindFunctionBySelector.keys()) { | |||
JsObjectArray<BindFunction> bindFunctions = bindFunctionBySelector.get(cssSelector); | |||
for (int i = 0; bindFunctions != null && i < bindFunctions.length(); i++) { | |||
@@ -361,7 +361,7 @@ public class EventsListener implements EventListener { | |||
static { | |||
// Register some special events which already exist in jQuery | |||
special = new HashMap<String, SpecialEvent>(); | |||
special = new HashMap<>(); | |||
special.put(MOUSEENTER, new MouseSpecialEvent(MOUSEENTER, "mouseover")); | |||
special.put(MOUSELEAVE, new MouseSpecialEvent(MOUSELEAVE, "mouseout")); | |||
} |
@@ -101,7 +101,7 @@ public class JsonBuilderGenerator extends Generator { | |||
if (isFactory) { | |||
generateCreateMethod(sw, treeLogger); | |||
} else { | |||
Set<String> attrs = new HashSet<String>(); | |||
Set<String> attrs = new HashSet<>(); | |||
for (JMethod method : clazz.getInheritableMethods()) { | |||
String methName = method.getName(); | |||
// skip method from JsonBuilder | |||
@@ -304,7 +304,7 @@ public class JsonBuilderGenerator extends Generator { | |||
private void generateCreateMethod(SourceWriter sw, TreeLogger logger) { | |||
sw.println("public <T extends " + JsonBuilder.class.getName() + "> T create(Class<T> clz) {"); | |||
sw.indent(); | |||
ArrayList<JClassType> types = new ArrayList<JClassType>(); | |||
ArrayList<JClassType> types = new ArrayList<>(); | |||
for (JClassType t : oracle.getTypes()) { | |||
if (t.isInterface() != null && t.isAssignableTo(jsonBuilderType)) { | |||
if (t.isPublic()) { |
@@ -51,7 +51,7 @@ public class SelectorGeneratorCssToXPath extends SelectorGeneratorBase { | |||
ReplaceCallback callback = (ReplaceCallback) o; | |||
while (matcher.find()) { | |||
final MatchResult matchResult = matcher.toMatchResult(); | |||
ArrayList<String> argss = new ArrayList<String>(); | |||
ArrayList<String> argss = new ArrayList<>(); | |||
for (int i = 0; i < matchResult.groupCount() + 1; i++) { | |||
argss.add(matchResult.group(i)); | |||
} |
@@ -93,7 +93,7 @@ public class SelectorGeneratorXPath extends SelectorGeneratorBase { | |||
} | |||
} | |||
ArrayList<String> cssSelectors = new ArrayList<String>(); | |||
ArrayList<String> cssSelectors = new ArrayList<>(); | |||
Matcher selm = selectorSplitRegExp.matcher(currentRule); | |||
while (selm.find()) { | |||
cssSelectors.add(selm.group(0)); |
@@ -15,8 +15,6 @@ | |||
*/ | |||
package com.google.gwt.query.vm; | |||
// import org.apache.http.impl.client.HttpClientBuilder; | |||
import com.google.gwt.http.client.RequestException; | |||
import com.google.gwt.http.client.Response; | |||
import com.google.gwt.query.client.Function; | |||
@@ -202,7 +200,7 @@ public class AjaxTransportJre implements AjaxTransport { | |||
if (is != null) { | |||
BufferedReader in = new BufferedReader(new InputStreamReader(is)); | |||
String inputLine; | |||
StringBuffer response = new StringBuffer(); | |||
StringBuilder response = new StringBuilder(); | |||
while ((inputLine = in.readLine()) != null) { | |||
response.append(inputLine + "\n"); | |||
} |
@@ -32,7 +32,7 @@ import java.util.StringTokenizer; | |||
public class CookieManager { | |||
private Map<String, Map<String, Map<String, String>>> store = | |||
new HashMap<String, Map<String, Map<String, String>>>(); | |||
new HashMap<>(); | |||
private static final String SET_COOKIE = "Set-Cookie"; | |||
private static final String COOKIE_VALUE_DELIMITER = ";"; | |||
@@ -78,12 +78,12 @@ public class CookieManager { | |||
String domain = getDomainFromHost(host); | |||
Map<String, Map<String, String>> domainStore = store.get(domain); | |||
if (domainStore == null) { | |||
domainStore = new HashMap<String, Map<String, String>>(); | |||
domainStore = new HashMap<>(); | |||
store.put(domain, domainStore); | |||
} | |||
Map<String, String> cookie = domainStore.get(name); | |||
if (cookie == null) { | |||
cookie = new HashMap<String, String>(); | |||
cookie = new HashMap<>(); | |||
domainStore.put(name, cookie); | |||
} | |||
if (value == null) { | |||
@@ -115,7 +115,7 @@ public class CookieManager { | |||
domainStore = store.get(domain); | |||
} else { | |||
// we don't, so let's create it and put it in the store | |||
domainStore = new HashMap<String, Map<String, String>>(); | |||
domainStore = new HashMap<>(); | |||
store.put(domain, domainStore); | |||
} | |||
@@ -124,7 +124,7 @@ public class CookieManager { | |||
String headerName = null; | |||
for (int i = 1; (headerName = conn.getHeaderFieldKey(i)) != null; i++) { | |||
if (headerName.equalsIgnoreCase(SET_COOKIE)) { | |||
Map<String, String> cookie = new HashMap<String, String>(); | |||
Map<String, String> cookie = new HashMap<>(); | |||
StringTokenizer st = new StringTokenizer(conn.getHeaderField(i), COOKIE_VALUE_DELIMITER); | |||
// the specification dictates that the first name/value pair | |||
@@ -173,7 +173,7 @@ public class CookieManager { | |||
Map<String, Map<String, String>> domainStore = store.get(domain); | |||
if (domainStore == null) | |||
return; | |||
StringBuffer cookieStringBuffer = new StringBuffer(); | |||
StringBuilder cookieStringBuffer = new StringBuilder(); | |||
Iterator<String> cookieNames = domainStore.keySet().iterator(); | |||
while (cookieNames.hasNext()) { |
@@ -71,7 +71,7 @@ public class JsonBuilderHandler implements InvocationHandler { | |||
return null; | |||
} | |||
List<T> l = new ArrayList<T>(); | |||
List<T> l = new ArrayList<>(); | |||
for (int i = 0; j != null && i < j.length(); i++) { | |||
l.add((T) getValue(j, i, null, null, ctype, null)); | |||
} | |||
@@ -83,7 +83,7 @@ public class JsonBuilderHandler implements InvocationHandler { | |||
try { | |||
return obj != null ? obj.getNumber(attr) : arr.getNumber(idx); | |||
} catch (Exception e) { | |||
return Double.valueOf(0d); | |||
return 0d; | |||
} | |||
} | |||
@@ -312,7 +312,7 @@ public class JsonBuilderHandler implements InvocationHandler { | |||
} | |||
private HashSet<String> getAttributeNames(Method[] methods) { | |||
HashSet<String> valid = new HashSet<String>(); | |||
HashSet<String> valid = new HashSet<>(); | |||
if (methods == null || methods.length == 0) { | |||
return valid; | |||
@@ -331,7 +331,7 @@ public class JsonBuilderHandler implements InvocationHandler { | |||
} | |||
private Hashtable<String, Method> getJsonBuilders(Method[] methods) { | |||
Hashtable<String, Method> ispropertyGetters = new Hashtable<String, Method>(); | |||
Hashtable<String, Method> ispropertyGetters = new Hashtable<>(); | |||
if (methods == null || methods.length == 0) { | |||
return ispropertyGetters; |
@@ -51,8 +51,8 @@ import javax.validation.ConstraintViolation; | |||
*/ | |||
public class PromiseRF extends DeferredPromiseImpl { | |||
private int total = 0; | |||
private List<Object> responses = new ArrayList<Object>(); | |||
private List<RequestContext> contexts = new ArrayList<RequestContext>(); | |||
private List<Object> responses = new ArrayList<>(); | |||
private List<RequestContext> contexts = new ArrayList<>(); | |||
/** | |||
* Fire a RF Request. |
@@ -1792,7 +1792,7 @@ public class GQueryCoreTestGwt extends GWTTestCase { | |||
if ($(e).attr("id").isEmpty() || $(e).attr("class").isEmpty()) { | |||
return null; | |||
} | |||
List<String> attrs = new ArrayList<String>(); | |||
List<String> attrs = new ArrayList<>(); | |||
attrs.add(e.getTagName()); | |||
attrs.add($(e).attr("class")); | |||
attrs.add($(e).attr("id")); | |||
@@ -2077,7 +2077,7 @@ public class GQueryCoreTestGwt extends GWTTestCase { | |||
GQuery target = $("#target", e); | |||
$("#target", e).data("intValue", new Integer(1)); | |||
$("#target", e).data("intValue", 1); | |||
Integer value = $("#target", e).data("intValue", Integer.class); | |||
@@ -129,7 +129,7 @@ public class GQueryJsTestGwt extends GWTTestCase { | |||
assertEquals(0, a.keys().length); | |||
assertEquals(0, a.elements().length); | |||
a.put("obj", new Long(21)); | |||
a.put("obj", 21L); | |||
assertEquals(1, a.length()); | |||
assertEquals(1, a.keys().length); | |||
assertEquals(1, a.elements().length); |
@@ -61,7 +61,7 @@ public class AjaxTestJre extends AjaxTests { | |||
protected void startWebServer(int port) throws Exception { | |||
if (server == null) { | |||
final Map<String, Class<? extends Servlet>> servlets = new HashMap<String, Class<? extends Servlet>>(); | |||
final Map<String, Class<? extends Servlet>> servlets = new HashMap<>(); | |||
servlets.put("/" + servletPath, GQAjaxTestServlet.class); | |||
server = createWebServer(port, ".", null, servlets, null); | |||
} |
@@ -49,7 +49,7 @@ public class DataBindingTestJre extends GWTTestCase { | |||
p1.set("e", true); | |||
assertEquals("1", p1.get("a")); | |||
assertEquals(Double.valueOf(1), p1.get("b")); | |||
assertEquals(1d, p1.get("b")); | |||
assertEquals("null", p1.get("c")); | |||
assertNull(p1.get("d")); | |||
assertTrue((Boolean)p1.get("e")); | |||
@@ -57,7 +57,7 @@ public class DataBindingTestJre extends GWTTestCase { | |||
p1 = GQ.create(p1.toJson()); | |||
assertEquals("1", p1.get("a")); | |||
assertEquals(Double.valueOf(1), p1.get("b")); | |||
assertEquals(1d, p1.get("b")); | |||
assertEquals("null", p1.get("c")); | |||
assertNull(p1.get("d")); | |||
} |
@@ -97,10 +97,10 @@ | |||
<plugin> | |||
<groupId>org.apache.maven.plugins</groupId> | |||
<artifactId>maven-compiler-plugin</artifactId> | |||
<version>3.2</version> | |||
<version>3.5</version> | |||
<configuration> | |||
<source>1.6</source> | |||
<target>1.6</target> | |||
<source>1.7</source> | |||
<target>1.7</target> | |||
</configuration> | |||
</plugin> | |||
</plugins> |