Debian Codegraph @

rhino/testsrc/tests/src/com/netscape/javascript/qa/lc3/bool/Boolean_008.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.bool;
6
7 /**
8 * 3.4 Preferred Argument Conversions
9 * 3.4.2 Boolean.
10 * Given a Java object that has several ambiguous methods, if JavaScript calls
11 * the ambiguous method with a boolean, the order of preference should be as
12 * follows, regardless of the order in which the methods are declared.
13 * boolean
14 * java.lang.Boolean
15 * java.lang.Object
16 * java.lang.String
17 * long, int, short, char, byte
18 * double, float
19 *
20 *
21 * In this case, the expected result depends on the specific method that is
22 * invoked. Invoking with using explicit method invocation results in a
23 * runtime error.
24 *
25 */
26
27 public class Boolean_008 {
28 public int BOOLEAN = 0;
29 public int BOOLEAN_OBJECT = 1;
30 public int OBJECT = 2;
31 public int STRING = 4;
32 public int LONG = 8;
33 public int INT = 16;
34 public int SHORT = 32;
35 public int CHAR = 64;
36 public int BYTE = 128;
37 public int DOUBLE = 256;
38 public int FLOAT = 512;
39
40 public int ambiguous( float arg ) {
41 return FLOAT;
42 }
43
44 public int ambiguous( double arg ) {
45 return DOUBLE;
46 }
47
48 public int ambiguous( byte arg ) {
49 return BYTE;
50 }
51
52 public int ambiguous( char arg ) {
53 return CHAR;
54 }
55
56 }