Skip to content

Commit

Permalink
Remove usages of JsArray and JavaScriptObject (#27)
Browse files Browse the repository at this point in the history
JavaScriptObject and JsArray are deprecated - internal usages can be
replaced with elemental or jsinterop-base, and some API usages can
be replaced with Object.
  • Loading branch information
zbynek authored Dec 18, 2023
1 parent 35844c3 commit 4db5390
Show file tree
Hide file tree
Showing 53 changed files with 111 additions and 161 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import com.google.gwt.junit.Platform;
import com.google.gwt.junit.client.GWTTestCase;
import java.util.Locale;
import org.gwtproject.core.client.JavaScriptObject;

/** Tests the {@link Node} class. */
public class NodeTest extends GWTTestCase {
Expand Down Expand Up @@ -296,7 +295,7 @@ public void testParentAndSiblings() {
public void testIsAndAs() {
assertTrue(Node.is(Document.get()));

JavaScriptObject text = Document.get().createTextNode("foo");
Object text = Document.get().createTextNode("foo");
assertTrue(Node.is(text));

// Node.is(null) is allowed and should return false.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import static junit.framework.TestCase.*;

import java.util.Locale;
import org.gwtproject.core.client.JavaScriptObject;
import org.junit.Test;

/** Tests the {@link Node} class. */
Expand Down Expand Up @@ -280,7 +279,7 @@ public void testParentAndSiblings() {
public void testIsAndAs() {
assertTrue(Node.is(Document.get()));

JavaScriptObject text = Document.get().createTextNode("foo");
Object text = Document.get().createTextNode("foo");
assertTrue(Node.is(text));

// Node.is(null) is allowed and should return false.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import jsinterop.annotations.JsPackage;
import jsinterop.annotations.JsProperty;
import jsinterop.annotations.JsType;
import org.gwtproject.core.client.JavaScriptObject;
import org.gwtproject.safehtml.shared.SafeUri;
import org.gwtproject.safehtml.shared.annotations.IsSafeUri;

Expand Down Expand Up @@ -49,14 +48,14 @@ public static AnchorElement as(Element elem) {
}

/**
* Determines whether the given {@link JavaScriptObject} can be cast to this class. A <code>null
* Determines whether the given object can be cast to this class. A <code>null
* </code> object will cause this method to return <code>false</code>.
*
* @param o the object to check if it is an instance of this type
* @return true of the object is an instance of this type, false otherwise
*/
@JsOverlay
public static boolean is(JavaScriptObject o) {
public static boolean is(Object o) {
if (Element.is(o)) {
return is((Element) o);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import jsinterop.annotations.JsPackage;
import jsinterop.annotations.JsProperty;
import jsinterop.annotations.JsType;
import org.gwtproject.core.client.JavaScriptObject;

/**
* Client-side image map area definition.
Expand Down Expand Up @@ -47,14 +46,14 @@ public static AreaElement as(Element elem) {
}

/**
* Determines whether the given {@link JavaScriptObject} can be cast to this class. A <code>null
* Determines whether the given object can be cast to this class. A <code>null
* </code> object will cause this method to return <code>false</code>.
*
* @param o the object to check if it is an instance of this type
* @return true of the object is an instance of this type, false otherwise
*/
@JsOverlay
public static boolean is(JavaScriptObject o) {
public static boolean is(Object o) {
if (Element.is(o)) {
return is((Element) o);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import jsinterop.annotations.JsOverlay;
import jsinterop.annotations.JsPackage;
import jsinterop.annotations.JsType;
import org.gwtproject.core.client.JavaScriptObject;

/**
* Force a line break.
Expand Down Expand Up @@ -46,14 +45,14 @@ public static BRElement as(Element elem) {
}

/**
* Determines whether the given {@link JavaScriptObject} can be cast to this class. A <code>null
* Determines whether the given object can be cast to this class. A <code>null
* </code> object will cause this method to return <code>false</code>.
*
* @param o the object to check if it is an instance of this type
* @return true of the object is an instance of this type, false otherwise
*/
@JsOverlay
public static boolean is(JavaScriptObject o) {
public static boolean is(Object o) {
if (Element.is(o)) {
return is((Element) o);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import jsinterop.annotations.JsPackage;
import jsinterop.annotations.JsProperty;
import jsinterop.annotations.JsType;
import org.gwtproject.core.client.JavaScriptObject;

/**
* Document base URI.
Expand Down Expand Up @@ -47,14 +46,14 @@ public static BaseElement as(Element elem) {
}

/**
* Determines whether the given {@link JavaScriptObject} can be cast to this class. A <code>null
* Determines whether the given object can be cast to this class. A <code>null
* </code> object will cause this method to return <code>false</code>.
*
* @param o the object to check if it is an instance of this type
* @return true of the object is an instance of this type, false otherwise
*/
@JsOverlay
public static boolean is(JavaScriptObject o) {
public static boolean is(Object o) {
if (Element.is(o)) {
return is((Element) o);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import jsinterop.annotations.JsOverlay;
import jsinterop.annotations.JsPackage;
import jsinterop.annotations.JsType;
import org.gwtproject.core.client.JavaScriptObject;

/**
* The HTML document body. This element is always present in the DOM API, even if the tags are not
Expand Down Expand Up @@ -47,14 +46,14 @@ public static BodyElement as(Element elem) {
}

/**
* Determines whether the given {@link JavaScriptObject} can be cast to this class. A <code>null
* Determines whether the given object can be cast to this class. A <code>null
* </code> object will cause this method to return <code>false</code>.
*
* @param o the object to check if it is an instance of this type
* @return true of the object is an instance of this type, false otherwise
*/
@JsOverlay
public static boolean is(JavaScriptObject o) {
public static boolean is(Object o) {
if (Element.is(o)) {
return is((Element) o);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import jsinterop.annotations.JsProperty;
import jsinterop.annotations.JsType;
import jsinterop.base.Js;
import org.gwtproject.core.client.JavaScriptObject;

/**
* Push button.
Expand Down Expand Up @@ -49,14 +48,14 @@ public static ButtonElement as(Element elem) {
}

/**
* Determines whether the given {@link JavaScriptObject} can be cast to this class. A <code>null
* Determines whether the given object can be cast to this class. A <code>null
* </code> object will cause this method to return <code>false</code>.
*
* @param o the object to check if it is an instance of this type
* @return true of the object is an instance of this type, false otherwise
*/
@JsOverlay
public static boolean is(JavaScriptObject o) {
public static boolean is(Object o) {
if (Element.is(o)) {
return is((Element) o);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import jsinterop.annotations.JsOverlay;
import jsinterop.annotations.JsPackage;
import jsinterop.annotations.JsType;
import org.gwtproject.core.client.JavaScriptObject;

/**
* Definition list.
Expand Down Expand Up @@ -46,14 +45,14 @@ public static DListElement as(Element elem) {
}

/**
* Determines whether the given {@link JavaScriptObject} can be cast to this class. A <code>null
* Determines whether the given object can be cast to this class. A <code>null
* </code> object will cause this method to return <code>false</code>.
*
* @param o the object to check if it is an instance of this type
* @return true of the object is an instance of this type, false otherwise
*/
@JsOverlay
public static boolean is(JavaScriptObject o) {
public static boolean is(Object o) {
if (Element.is(o)) {
return is((Element) o);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import jsinterop.annotations.JsOverlay;
import jsinterop.annotations.JsPackage;
import jsinterop.annotations.JsType;
import org.gwtproject.core.client.JavaScriptObject;

/**
* Generic block container.
Expand Down Expand Up @@ -46,14 +45,14 @@ public static DivElement as(Element elem) {
}

/**
* Determines whether the given {@link JavaScriptObject} can be cast to this class. A <code>null
* Determines whether the given can be cast to this class. A <code>null
* </code> object will cause this method to return <code>false</code>.
*
* @param o the object to check if it is an instance of this type
* @return true of the object is an instance of this type, false otherwise
*/
@JsOverlay
public static boolean is(JavaScriptObject o) {
public static boolean is(Object o) {
if (Element.is(o)) {
return is((Element) o);
}
Expand Down
4 changes: 2 additions & 2 deletions gwt-dom/src/main/java/org/gwtproject/dom/client/Element.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,14 @@ public static Element as(Node node) {
}

/**
* Determines whether the given {@link JavaScriptObject} can be cast to an {@link Element}. A
* Determines whether the given object can be cast to an {@link Element}. A
* <code>null</code> object will cause this method to return <code>false</code>.
*
* @param o the object to check if it is an instance of this type
* @return true of the object is an instance of this type, false otherwise
*/
@JsOverlay
public static boolean is(JavaScriptObject o) {
public static boolean is(Object o) {
if (Node.is(o)) {
return is((Node) o);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* Represents the target of a JavaScript event.
*
* <p>This type is returned from methods such as {@link NativeEvent#getEventTarget()}, and must
* usually be cast to another type using methods such as {@link Element#is(JavaScriptObject)} and
* usually be cast to another type using methods such as {@link Element#is(Object)} and
* {@link Element#as(JavaScriptObject)}.
*
* <p>This class intentionally does <em>not</em> specify the methods from the DOM IDL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import jsinterop.annotations.JsPackage;
import jsinterop.annotations.JsProperty;
import jsinterop.annotations.JsType;
import org.gwtproject.core.client.JavaScriptObject;

/**
* Organizes form controls into logical groups.
Expand Down Expand Up @@ -48,14 +47,14 @@ public static FieldSetElement as(Element elem) {
}

/**
* Determines whether the given {@link JavaScriptObject} can be cast to this class. A <code>null
* Determines whether the given object can be cast to this class. A <code>null
* </code> object will cause this method to return <code>false</code>.
*
* @param o the object to check if it is an instance of this type
* @return true of the object is an instance of this type, false otherwise
*/
@JsOverlay
public static boolean is(JavaScriptObject o) {
public static boolean is(Object o) {
if (Element.is(o)) {
return is((Element) o);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import jsinterop.annotations.JsPackage;
import jsinterop.annotations.JsProperty;
import jsinterop.annotations.JsType;
import org.gwtproject.core.client.JavaScriptObject;
import org.gwtproject.safehtml.shared.SafeUri;
import org.gwtproject.safehtml.shared.annotations.IsSafeUri;

Expand Down Expand Up @@ -50,14 +49,14 @@ public static FormElement as(Element elem) {
}

/**
* Determines whether the given {@link JavaScriptObject} can be cast to this class. A <code>null
* Determines whether the given object can be cast to this class. A <code>null
* </code> object will cause this method to return <code>false</code>.
*
* @param o the object to check if it is an instance of this type
* @return true of the object is an instance of this type, false otherwise
*/
@JsOverlay
public static boolean is(JavaScriptObject o) {
public static boolean is(Object o) {
if (Element.is(o)) {
return is((Element) o);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import jsinterop.annotations.JsProperty;
import jsinterop.annotations.JsType;
import jsinterop.base.Js;
import org.gwtproject.core.client.JavaScriptObject;
import org.gwtproject.safehtml.shared.SafeUri;
import org.gwtproject.safehtml.shared.annotations.IsSafeUri;
import org.gwtproject.safehtml.shared.annotations.IsTrustedResourceUri;
Expand Down Expand Up @@ -53,14 +52,14 @@ public static FrameElement as(Element elem) {
}

/**
* Determines whether the given {@link JavaScriptObject} can be cast to this class. A <code>null
* Determines whether the given object can be cast to this class. A <code>null
* </code> object will cause this method to return <code>false</code>.
*
* @param o the object to check if it is an instance of this type
* @return true of the object is an instance of this type, false otherwise
*/
@JsOverlay
public static boolean is(JavaScriptObject o) {
public static boolean is(Object o) {
if (Element.is(o)) {
return is((Element) o);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import jsinterop.annotations.JsPackage;
import jsinterop.annotations.JsProperty;
import jsinterop.annotations.JsType;
import org.gwtproject.core.client.JavaScriptObject;

/**
* Create a grid of frames.
Expand Down Expand Up @@ -48,14 +47,14 @@ public static FrameSetElement as(Element elem) {
}

/**
* Determines whether the given {@link JavaScriptObject} can be cast to this class. A <code>null
* Determines whether the given object can be cast to this class. A <code>null
* </code> object will cause this method to return <code>false</code>.
*
* @param o the object to check if it is an instance of this type
* @return true of the object is an instance of this type, false otherwise
*/
@JsOverlay
public static boolean is(JavaScriptObject o) {
public static boolean is(Object o) {
if (Element.is(o)) {
return is((Element) o);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import jsinterop.annotations.JsOverlay;
import jsinterop.annotations.JsPackage;
import jsinterop.annotations.JsType;
import org.gwtproject.core.client.JavaScriptObject;

/**
* Create a horizontal rule.
Expand Down Expand Up @@ -46,14 +45,14 @@ public static HRElement as(Element elem) {
}

/**
* Determines whether the given {@link JavaScriptObject} can be cast to this class. A <code>null
* Determines whether the given object can be cast to this class. A <code>null
* </code> object will cause this method to return <code>false</code>.
*
* @param o the object to check if it is an instance of this type
* @return true of the object is an instance of this type, false otherwise
*/
@JsOverlay
public static boolean is(JavaScriptObject o) {
public static boolean is(Object o) {
if (Element.is(o)) {
return is((Element) o);
}
Expand Down
Loading

0 comments on commit 4db5390

Please sign in to comment.