# HG changeset patch # User Jaroslav Tulach # Date 1452854428 -3600 # Node ID 36165f49f5986e902aa3b242662d03775083ace1 # Parent 6f1a8b251b7d1402a70422f10af556e058be77d6 Use fully qualified names when referencing java.lang.Object diff -r 6f1a8b251b7d -r 36165f49f598 boot/src/test/java/org/netbeans/html/boot/impl/CountFnCreationTest.java --- a/boot/src/test/java/org/netbeans/html/boot/impl/CountFnCreationTest.java Mon Sep 21 21:19:13 2015 +0200 +++ b/boot/src/test/java/org/netbeans/html/boot/impl/CountFnCreationTest.java Fri Jan 15 11:40:28 2016 +0100 @@ -49,8 +49,6 @@ import java.net.URL; import java.util.Collection; import java.util.Enumeration; -import java.util.logging.Level; -import java.util.logging.Logger; import net.java.html.js.JavaScriptBody; import net.java.html.js.JavaScriptResource; import org.netbeans.html.boot.spi.Fn; @@ -118,7 +116,7 @@ } @Override - public Object invoke(Object thiz, Object... args) throws Exception { + public java.lang.Object invoke(java.lang.Object thiz, java.lang.Object... args) throws Exception { return null; } } diff -r 6f1a8b251b7d -r 36165f49f598 boot/src/test/java/org/netbeans/html/boot/impl/FnTest.java --- a/boot/src/test/java/org/netbeans/html/boot/impl/FnTest.java Mon Sep 21 21:19:13 2015 +0200 +++ b/boot/src/test/java/org/netbeans/html/boot/impl/FnTest.java Fri Jan 15 11:40:28 2016 +0100 @@ -106,16 +106,16 @@ sb.append("};"); sb.append("})()"); try { - final Object val = eng.eval(sb.toString()); + final java.lang.Object val = eng.eval(sb.toString()); return new Fn(this) { @Override - public Object invoke(Object thiz, Object... args) throws Exception { - List all = new ArrayList(args.length + 1); + public java.lang.Object invoke(java.lang.Object thiz, java.lang.Object... args) throws Exception { + List all = new ArrayList(args.length + 1); all.add(thiz == null ? val : thiz); all.addAll(Arrays.asList(args)); Invocable inv = (Invocable)eng; try { - Object ret = inv.invokeMethod(val, "call", all.toArray()); + java.lang.Object ret = inv.invokeMethod(val, "call", all.toArray()); return val.equals(ret) ? null : ret; } catch (ScriptException ex) { throw ex; diff -r 6f1a8b251b7d -r 36165f49f598 boot/src/test/java/org/netbeans/html/boot/impl/JavaScriptProcesorTest.java --- a/boot/src/test/java/org/netbeans/html/boot/impl/JavaScriptProcesorTest.java Mon Sep 21 21:19:13 2015 +0200 +++ b/boot/src/test/java/org/netbeans/html/boot/impl/JavaScriptProcesorTest.java Fri Jan 15 11:40:28 2016 +0100 @@ -155,7 +155,7 @@ @Test public void generatesCallbacksThatReturnObject() throws Exception { Class callbacksForTestPkg = Class.forName("org.netbeans.html.boot.impl.$JsCallbacks$"); Method m = callbacksForTestPkg.getDeclaredMethod("java_lang_Runnable$run$", Runnable.class); - assertEquals(m.getReturnType(), Object.class, "All methods always return object"); + assertEquals(m.getReturnType(), java.lang.Object.class, "All methods always return object"); } @Test public void hasInstanceField() throws Exception { diff -r 6f1a8b251b7d -r 36165f49f598 boot/src/test/java/org/netbeans/html/boot/impl/JsClassLoaderBase.java --- a/boot/src/test/java/org/netbeans/html/boot/impl/JsClassLoaderBase.java Mon Sep 21 21:19:13 2015 +0200 +++ b/boot/src/test/java/org/netbeans/html/boot/impl/JsClassLoaderBase.java Fri Jan 15 11:40:28 2016 +0100 @@ -46,8 +46,6 @@ import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Modifier; -import java.util.logging.Level; -import java.util.logging.Logger; import org.netbeans.html.boot.spi.Fn; import org.testng.Assert; import static org.testng.Assert.*; @@ -72,7 +70,7 @@ @Test public void noParamMethod() throws Throwable { Method plus = methodClass.getMethod("fortyTwo"); try { - final Object val = plus.invoke(null); + final java.lang.Object val = plus.invoke(null); assertTrue(val instanceof Number, "A number returned " + val); assertEquals(((Number)val).intValue(), 42); } catch (InvocationTargetException ex) { @@ -100,7 +98,7 @@ @Test public void instanceMethod() throws Throwable { Method plus = methodClass.getMethod("plusInst", int.class); - Object inst = methodClass.newInstance(); + java.lang.Object inst = methodClass.newInstance(); try { assertEquals(plus.invoke(inst, 10), 10); } catch (InvocationTargetException ex) { @@ -118,7 +116,7 @@ } @Test public void getThis() throws Throwable { - Object th = methodClass.newInstance(); + java.lang.Object th = methodClass.newInstance(); Method st = methodClass.getMethod("getThis"); try { assertEquals(st.invoke(th), th); @@ -166,7 +164,7 @@ @Test public void callJavaScriptMethodOnOwnClass() throws Throwable { try { - Object thiz = methodClass.newInstance(); + java.lang.Object thiz = methodClass.newInstance(); Method st = methodClass.getMethod("returnYourSelf", methodClass); assertEquals(st.invoke(null, thiz), thiz, "Returns this"); } catch (InvocationTargetException ex) { @@ -190,7 +188,7 @@ Class enmClazz2 = enmClazz.asSubclass(Enum.class); Method st = methodClass.getMethod("fromEnum", enmClazz); - Object valueB = Enum.valueOf(enmClazz2, "B"); + java.lang.Object valueB = Enum.valueOf(enmClazz2, "B"); assertEquals(st.invoke(null, valueB), "B", "Converts to string"); } @@ -210,7 +208,7 @@ } @Test public void recordError() throws Throwable { - Method st = methodClass.getMethod("recordError", Object.class); + Method st = methodClass.getMethod("recordError", java.lang.Object.class); assertEquals(st.invoke(methodClass.newInstance(), "Hello"), "Hello", "The same parameter returned"); } @@ -239,10 +237,10 @@ @Test public void arrayInOut() throws Throwable { String[] arr = { "Ahoj" }; - Method st = methodClass.getMethod("arr", Object[].class); - Object ret = st.invoke(null, (Object) arr); - assertTrue(ret instanceof Object[], "Expecting array: " + ret); - Object[] res = (Object[]) ret; + Method st = methodClass.getMethod("arr", java.lang.Object[].class); + java.lang.Object ret = st.invoke(null, (java.lang.Object) arr); + assertTrue(ret instanceof java.lang.Object[], "Expecting array: " + ret); + java.lang.Object[] res = (java.lang.Object[]) ret; assertEquals(res.length, 1, "One element"); assertEquals(res[0], "Ahoj", "The right string"); } @@ -250,7 +248,7 @@ @Test public void checkTheTypeOfThrownException() throws Throwable { FnContext.currentPresenter(null); assertNull(Fn.activePresenter(), "No presenter is activer right now"); - Object res = null; + java.lang.Object res = null; try { Method st = methodClass.getMethod("plus", int.class, int.class); try { diff -r 6f1a8b251b7d -r 36165f49f598 boot/src/test/java/org/netbeans/html/boot/impl/JsClassLoaderTest.java --- a/boot/src/test/java/org/netbeans/html/boot/impl/JsClassLoaderTest.java Mon Sep 21 21:19:13 2015 +0200 +++ b/boot/src/test/java/org/netbeans/html/boot/impl/JsClassLoaderTest.java Fri Jan 15 11:40:28 2016 +0100 @@ -44,7 +44,6 @@ import java.io.Closeable; import java.io.Reader; -import org.netbeans.html.boot.spi.Fn; import java.net.URL; import java.net.URLClassLoader; import java.util.ArrayList; @@ -56,6 +55,7 @@ import javax.script.ScriptEngine; import javax.script.ScriptEngineManager; import javax.script.ScriptException; +import org.netbeans.html.boot.spi.Fn; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeMethod; @@ -101,16 +101,16 @@ sb.append("};"); sb.append("})()"); try { - final Object val = eng.eval(sb.toString()); + final java.lang.Object val = eng.eval(sb.toString()); return new Fn(this) { @Override - public Object invoke(Object thiz, Object... args) throws Exception { - List all = new ArrayList(args.length + 1); + public java.lang.Object invoke(java.lang.Object thiz, java.lang.Object... args) throws Exception { + List all = new ArrayList(args.length + 1); all.add(thiz == null ? val : thiz); all.addAll(Arrays.asList(args)); Invocable inv = (Invocable)eng; try { - Object ret = inv.invokeMethod(val, "call", all.toArray()); + java.lang.Object ret = inv.invokeMethod(val, "call", all.toArray()); return val.equals(ret) ? null : ret; } catch (Exception ex) { throw ex; diff -r 6f1a8b251b7d -r 36165f49f598 boot/src/test/java/org/netbeans/html/boot/impl/JsMethods.java --- a/boot/src/test/java/org/netbeans/html/boot/impl/JsMethods.java Mon Sep 21 21:19:13 2015 +0200 +++ b/boot/src/test/java/org/netbeans/html/boot/impl/JsMethods.java Fri Jan 15 11:40:28 2016 +0100 @@ -52,10 +52,10 @@ */ @JavaScriptResource("jsmethods.js") public class JsMethods { - private Object value; + private java.lang.Object value; @JavaScriptBody(args = {}, body = "return 42;") - public static Object fortyTwo() { + public static java.lang.Object fortyTwo() { return -42; } @@ -66,10 +66,10 @@ public static native int plus(int x); @JavaScriptBody(args = {}, body = "return this;") - public static native Object staticThis(); + public static native java.lang.Object staticThis(); @JavaScriptBody(args = {}, body = "return this;") - public native Object getThis(); + public native java.lang.Object getThis(); @JavaScriptBody(args = {"x"}, body = "return x;") public native int plusInst(int x); @@ -110,7 +110,7 @@ public static native String fromEnum(Enm v); @JavaScriptBody(args = "arr", body = "return arr;") - public static native Object[] arr(Object[] arr); + public static native java.lang.Object[] arr(java.lang.Object[] arr); @JavaScriptBody(args = { "useA", "useB", "a", "b" }, body = "var l = 0;" + "if (useA) l += a;\n" @@ -119,11 +119,11 @@ ) public static native long chooseLong(boolean useA, boolean useB, long a, long b); - protected void onError(Object o) throws Exception { + protected void onError(java.lang.Object o) throws Exception { value = o; } - Object getError() { + java.lang.Object getError() { return value; } @@ -131,7 +131,7 @@ "this.@org.netbeans.html.boot.impl.JsMethods::onError(Ljava/lang/Object;)(err);" + "return this.@org.netbeans.html.boot.impl.JsMethods::getError()();" ) - public native Object recordError(Object err); + public native java.lang.Object recordError(java.lang.Object err); @JavaScriptBody(args = { "x", "y" }, body = "return x + y;") public static int plusOrMul(int x, int y) { @@ -139,7 +139,7 @@ } @JavaScriptBody(args = { "x" }, keepAlive = false, body = "throw 'Do not call me!'") - public static native int checkAllowGC(Object x); + public static native int checkAllowGC(java.lang.Object x); enum Enm { A, B; diff -r 6f1a8b251b7d -r 36165f49f598 boot/src/test/java/org/netbeans/html/boot/impl/KeepAliveTest.java --- a/boot/src/test/java/org/netbeans/html/boot/impl/KeepAliveTest.java Mon Sep 21 21:19:13 2015 +0200 +++ b/boot/src/test/java/org/netbeans/html/boot/impl/KeepAliveTest.java Fri Jan 15 11:40:28 2016 +0100 @@ -48,8 +48,6 @@ import java.util.Collection; import org.netbeans.html.boot.spi.Fn; import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertFalse; -import static org.testng.Assert.assertTrue; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; @@ -57,7 +55,7 @@ private Class jsMethods; @Test public void keepAliveIsSetToFalse() throws Exception { Closeable c = Fn.activate(this); - Number ret = (Number)jsMethods.getMethod("checkAllowGC", Object.class).invoke(null, this); + Number ret = (Number)jsMethods.getMethod("checkAllowGC", java.lang.Object.class).invoke(null, this); c.close(); assertEquals(ret.intValue(), 0, "keepAlive is set to false"); } @@ -79,7 +77,7 @@ public Fn defineFn(String code, String[] names, final boolean[] keepAlive) { return new Fn(this) { @Override - public Object invoke(Object thiz, Object... args) throws Exception { + public java.lang.Object invoke(java.lang.Object thiz, java.lang.Object... args) throws Exception { boolean res = true; if (keepAlive != null) { for (int i = 0; i < keepAlive.length; i++) {