rhino/testsrc/tests/src/com/netscape/javascript/qa/lc3/undefined/Undefined_001.java
raw symbols SCIP| 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
| 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
| 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
| 4 | |
| 5 | package com.netscape.javascript.qa.lc3.undefined; |
| 6 | |
| 7 | /** |
| 8 | * 3.4 Preferred Argument Conversions |
| 9 | * 3.4.1 Undefined |
| 10 | * |
| 11 | * The JavaScript value of undefined can be passed to methods that expect |
| 12 | * either a java.lang.String or a java.lang.Object. |
| 13 | * |
| 14 | * It is an error if undefined is passed to an ambiguous method (the object |
| 15 | * contains methods that accept either a java.lang.String or java.lang.Object). |
| 16 | * |
| 17 | * You should be able to call the ambiguous methods explicitly using the |
| 18 | * Explicit Method invocation. |
| 19 | * |
| 20 | */ |
| 21 | |
| 22 | public class Undefined_001 { |
| 23 | public String OBJECT = "OBJECT"; |
| 24 | public String STRING = "STRING"; |
| 25 | |
| 26 | public static String STATIC_OBJECT = "OBJECT"; |
| 27 | public static String STATIC_STRING = "STRING"; |
| 28 | |
| 29 | |
| 30 | public String ambiguous( String arg ) { |
| 31 | return STRING; |
| 32 | } |
| 33 | |
| 34 | public String ambiguous( Object arg ) { |
| 35 | return OBJECT; |
| 36 | } |
| 37 | |
| 38 | public static String staticAmbiguous( String arg ) { |
| 39 | return STATIC_STRING; |
| 40 | } |
| 41 | |
| 42 | public static String staticAmbiguous( Object arg ) { |
| 43 | return STATIC_OBJECT; |
| 44 | } |
| 45 | |
| 46 | } |