/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* @test
* @bug 4889342
* @summary This test verifies that when a primitive boolean value is
* passed by a dynamic proxy class to an invocation handler, it is
* boxed as one of the canonical Boolean instances (Boolean.TRUE or
* Boolean.FALSE). This test also exercises a dynamic proxy class's
* boxing of all primitive types.
* @author Peter Jones
*
* @run main Boxing
*/
public class Boxing {
private interface Test {
void m(byte b,
char c,
double d,
float f,
int i,
long j,
short s,
boolean z);
}
private byte b;
private char c;
private double d;
private float f;
private int i;
private long j;
private short s;
private boolean z;
}
private void run() {
Test.class.getClassLoader(),
new TestHandler());
d = random.nextDouble();
z = random.nextBoolean();
proxy.m(b,c,d,f,i,j,s,z);
}
}
throws Throwable
{
throw new AssertionError();
}
if (b2 != b) {
throw new RuntimeException("TEST FAILED: " +
}
if (c2 != c) {
throw new RuntimeException("TEST FAILED: " +
}
if (d2 != d) {
throw new RuntimeException("TEST FAILED: " +
}
if (f2 != f) {
throw new RuntimeException("TEST FAILED: " +
}
if (i2 != i) {
throw new RuntimeException("TEST FAILED: " +
}
if (j2 != j) {
throw new RuntimeException("TEST FAILED: " +
}
if (s2 != s) {
throw new RuntimeException("TEST FAILED: " +
}
if (Z2 != Z) {
throw new RuntimeException("TEST FAILED: " +
"wrong Boolean instance, expected " +
}
return null;
}
}
}
}