8057035: Some tests failed using java.awt.Color on Solaris without X11 libraries
Reviewed-by: lagergren
Contributed-by: Sergey Lugovoy <sergey.lugovoy@oracle.com>
--- a/nashorn/test/script/basic/JDK-8043232.js Wed Sep 17 15:02:42 2014 +0530
+++ b/nashorn/test/script/basic/JDK-8043232.js Wed Sep 17 16:44:23 2014 +0400
@@ -29,14 +29,14 @@
*/
// call explicit constructor
-print(new (java.awt["Color(int,int,int)"])(255,0,255));
+print(new (java.lang["String(char[],int,int)"])(['a','b', 'c', 'd'], 1, 3));
// print the constructor itself
-print(java.awt["Color(int,int,int)"]);
+print(java.lang["String(char[],int,int)"]);
// store constructor to call later
-var Color = java.awt["Color(int,int,int)"];
+var Color = java.lang["String(char[],int,int)"];
// call stored constructor
-print(new Color(33, 233, 2))
+print(new Color(['r','r', 'e', 'd'], 1, 3))
// check if default constructor works
var obj = new (java.lang["Object()"])();
--- a/nashorn/test/script/basic/JDK-8043232.js.EXPECTED Wed Sep 17 15:02:42 2014 +0530
+++ b/nashorn/test/script/basic/JDK-8043232.js.EXPECTED Wed Sep 17 16:44:23 2014 +0400
@@ -1,6 +1,6 @@
-java.awt.Color[r=255,g=0,b=255]
-[jdk.internal.dynalink.beans.SimpleDynamicMethod Color java.awt.Color.java.awt.Color(int,int,int)]
-java.awt.Color[r=33,g=233,b=2]
+bcd
+[jdk.internal.dynalink.beans.SimpleDynamicMethod String java.lang.String.java.lang.String(char[],int,int)]
+red
TypeError: No such Java class: java.lang.NonExistent
TypeError: No such Java constructor: Object(String)
TypeError: Java constructor signature invalid: Object()xxxxx
@@ -8,7 +8,7 @@
TypeError: Java constructor signature invalid: Object)
TypeError: Java method [jdk.internal.dynalink.beans.OverloadedDynamicMethod java.lang.System.getProperty] cannot be used as a constructor.
TypeError: Java method [jdk.internal.dynalink.beans.OverloadedDynamicMethod java.io.PrintStream.println] cannot be used as a constructor.
-TypeError: Constructor [jdk.internal.dynalink.beans.SimpleDynamicMethod Color java.awt.Color.java.awt.Color(int,int,int)] requires "new".
+TypeError: Constructor [jdk.internal.dynalink.beans.SimpleDynamicMethod String java.lang.String.java.lang.String(char[],int,int)] requires "new".
TypeError: No such Java constructor: Runnable()
TypeError: No such Java constructor: Runnable(int)
java.lang.InstantiationException: java.io.InputStream
--- a/nashorn/test/script/basic/JDK-8049086.js Wed Sep 17 15:02:42 2014 +0530
+++ b/nashorn/test/script/basic/JDK-8049086.js Wed Sep 17 16:44:23 2014 +0400
@@ -58,7 +58,7 @@
// (a) Java methods (b) Java classes (as these respond to new)
// (c) FunctionalInterface objects (d) JSObjects that are 'functions'
-print("java.awt.Color is java function? " + Java.isJavaFunction(java.awt.Color));
+print("java.lang.String is java function? " + Java.isJavaFunction(java.lang.String));
print("java.lang.Runnable instance is java function? "
+ Java.isJavaFunction(new java.lang.Runnable(function() {})));
print("eval is java function? " + Java.isJavaFunction(eval));
--- a/nashorn/test/script/basic/JDK-8049086.js.EXPECTED Wed Sep 17 15:02:42 2014 +0530
+++ b/nashorn/test/script/basic/JDK-8049086.js.EXPECTED Wed Sep 17 16:44:23 2014 +0400
@@ -13,7 +13,7 @@
Object is script object? true
{} is script object? true
/foo/ is script object? true
-java.awt.Color is java function? true
+java.lang.String is java function? true
java.lang.Runnable instance is java function? true
eval is java function? false
println is java function? true
--- a/nashorn/test/script/basic/JDK-8049242.js Wed Sep 17 15:02:42 2014 +0530
+++ b/nashorn/test/script/basic/JDK-8049242.js Wed Sep 17 16:44:23 2014 +0400
@@ -29,14 +29,14 @@
*/
// call explicit constructor
-print(new (Java.type("java.awt.Color")["(int,int,int)"])(255,0,255));
+print(new (Java.type("java.lang.String")["(char[],int,int)"])(['a', 'b', 'c'],0, 3));
// print the constructor itself
-print(Java.type("java.awt.Color")["(int,int,int)"]);
+print(Java.type("java.lang.String")["(char[],int,int)"]);
// store constructor to call later
-var Color = Java.type("java.awt.Color")["(int,int,int)"];
+var Color = Java.type("java.lang.String")["(char[],int,int)"];
// call stored constructor
-print(new Color(33, 233, 2))
+print(new Color(['j', 'a', 'v', 'a'], 1, 3))
// check if default constructor works
var obj = new (Java.type("java.lang.Object")["()"])();
--- a/nashorn/test/script/basic/JDK-8049242.js.EXPECTED Wed Sep 17 15:02:42 2014 +0530
+++ b/nashorn/test/script/basic/JDK-8049242.js.EXPECTED Wed Sep 17 16:44:23 2014 +0400
@@ -1,10 +1,10 @@
-java.awt.Color[r=255,g=0,b=255]
-[jdk.internal.dynalink.beans.SimpleDynamicMethod Color java.awt.Color.java.awt.Color(int,int,int)]
-java.awt.Color[r=33,g=233,b=2]
+abc
+[jdk.internal.dynalink.beans.SimpleDynamicMethod String java.lang.String.java.lang.String(char[],int,int)]
+ava
TypeError: null is not a function
TypeError: null is not a function
TypeError: null is not a function
-TypeError: Constructor [jdk.internal.dynalink.beans.SimpleDynamicMethod Color java.awt.Color.java.awt.Color(int,int,int)] requires "new".
+TypeError: Constructor [jdk.internal.dynalink.beans.SimpleDynamicMethod String java.lang.String.java.lang.String(char[],int,int)] requires "new".
TypeError: null is not a function
TypeError: null is not a function
java.lang.InstantiationException: java.io.InputStream