Debian Codegraph @

rhino/testsrc/tests/src/com/netscape/javascript/qa/lc3/bool/Boolean_003.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
22 public class Boolean_003 {
23 public int BOOLEAN = 0;
24 public int BOOLEAN_OBJECT = 1;
25 public int OBJECT = 2;
26 public int STRING = 4;
27 public int LONG = 8;
28 public int INT = 16;
29 public int SHORT = 32;
30 public int CHAR = 64;
31 public int BYTE = 128;
32 public int DOUBLE = 256;
33 public int FLOAT = 512;
34
35 public int ambiguous( float arg ) {
36 return FLOAT;
37 }
38
39 public int ambiguous( double arg ) {
40 return DOUBLE;
41 }
42
43 public int ambiguous( byte arg ) {
44 return BYTE;
45 }
46
47 public int ambiguous( char arg ) {
48 return CHAR;
49 }
50
51 public int ambiguous( short arg ) {
52 return SHORT;
53 }
54
55 public int ambiguous( int arg ) {
56 return INT;
57 }
58
59 public int ambiguous( long arg ) {
60 return LONG;
61 }
62
63 public int ambiguous( String arg ) {
64 return STRING;
65 }
66
67 public int ambiguous( Object arg ) {
68 return OBJECT;
69 }
70 public int expect() {
71 return OBJECT;
72 }
73
74 }