/* * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * 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 4359628 * @summary Test fix for JDI: methods Accessible.is...() lie about array types * @author Tim Bell * * @run build TestScaffold VMConnection TargetListener TargetAdapter * @run compile -g AccessSpecifierTest.java * @run driver AccessSpecifierTest
*/ import com.sun.jdi.*; import com.sun.jdi.event.*; import com.sun.jdi.request.*;
/** Sample package-private class. */ class AccessSpecifierPackagePrivateClass {}
/** Sample package-private class. */ class AccessSpecifierPackagePrivateClassTwo implements
AccessSpecifierPackagePrivateInterface {}
class AccessSpecifierTarg { privateboolean z0; boolean z1[]={z0}, z2[][]={z1};
publicbyte b0; byte b1[]={b0}, b2[][]={b1};
protectedshort s0; short s1[]={s0}, s2[][]={s1};
int i0; int i1[]={i0}, i2[][]={i1};
privatelong l0; long l1[]={l0}, l2[][]={l1};
publicchar c0; char c1[]={c0}, c2[][]={c1};
protectedfloat f0; float f1[]={f0}, f2[][]={f1};
double d0; double d1[]={d0}, d2[][]={d1};
Boolean Z0 = Boolean.TRUE; Boolean Z1[]={Z0}, Z2[][]={Z1}; Byte B0 = newByte ((byte)0x1f); Byte B1[]={B0}, B2[][]={B1};
Character C0 = new Character ('a');
Character C1[]={C0}, C2[][]={C1}; Double D0 = newDouble (1.0d); Double D1[]={D0}, D2[][]={D1}; Float F0 = newFloat (2.0f); Float F1[]={F0}, F2[][]={F1};
Integer I0 = new Integer (8675309);
Integer I1[]={I0}, I2[][]={I1}; Long L0 = newLong (973230999L); Long L1[]={L0}, L2[][]={L1};
String S0 = "A String";
String S1[]={S0}, S2[][]={S1};
Object O0 = new Object();
Object O1[]={O0}, O2[][]={O1};
privatestaticclass U {} protectedstaticclass V {} publicstaticclass W {} staticclass P {} // package private
U u0=new U(), u1[]={u0}, u2[][]={u1};
V v0=new V(), v1[]={v0}, v2[][]={v1};
W w0=new W(), w1[]={w0}, w2[][]={w1};
P p0=new P(), p1[]={p0}, p2[][]={p1};
publicstaticvoid main(String[] args){
System.out.println("Howdy!");
AccessSpecifierTarg my = new AccessSpecifierTarg();
my.ready();
System.out.println("Goodbye from AccessSpecifierTarg!");
}
}
/* * resume the target listening for events
*/
listenUntilVMDisconnect();
/* * deal with results of test * if anything has called failure("foo") testFailed will be true
*/ if (!testFailed) {
println("AccessSpecifierTest: passed");
} else { thrownew Exception("AccessSpecifierTest: failed");
}
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.