| 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 | * In this case, the expected result depends on the specific method that is |
| 21 | * invoked. Invoking with using explicit method invocation results in a |
| 22 | * runtime error. |
| 23 | * |
| 24 | */ |
| 25 | |
| 26 | public class Boolean_009 { |
| 27 | public int BOOLEAN = 0; |
| 28 | public int BOOLEAN_OBJECT = 1; |
| 29 | public int OBJECT = 2; |
| 30 | public int STRING = 4; |
| 31 | public int LONG = 8; |
| 32 | public int INT = 16; |
| 33 | public int SHORT = 32; |
| 34 | public int CHAR = 64; |
| 35 | public int BYTE = 128; |
| 36 | public int DOUBLE = 256; |
| 37 | public int FLOAT = 512; |
| 38 | |
| 39 | public int ambiguous( float arg ) { |
| 40 | return FLOAT; |
| 41 | } |
| 42 | |
| 43 | public int ambiguous( double arg ) { |
| 44 | return DOUBLE; |
| 45 | } |
| 46 | |
| 47 | public int ambiguous( byte arg ) { |
| 48 | return BYTE; |
| 49 | } |
| 50 | |
| 51 | } |