/*
* 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 6292705
* @summary Test support for arrays in parameterized types.
* @author Luis-Miguel Alventosa
* @run clean GenericArrayTypeTest
* @run build GenericArrayTypeTest
* @run main GenericArrayTypeTest
*/
public class GenericArrayTypeTest {
// A version of java.lang.management.MonitorInfo so we can run this test
// on JDK 5, where that class didn't exist.
public static class MonitorInfo {
private final int identityHashCode;
private final int lockedStackDepth;
public MonitorInfo(
this.identityHashCode = identityHashCode;
this.lockedStackDepth = lockedStackDepth;
this.lockedStackFrame = lockedStackFrame;
}
try {
return new MonitorInfo(
ste);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
return className;
}
public int getIdentityHashCode() {
return identityHashCode;
}
public int getLockedStackDepth() {
return lockedStackDepth;
}
return lockedStackFrame;
}
}
public interface TestMXBean {
}
return t1;
}
t1 = v;
}
return t2;
}
t2 = v;
}
return t3;
}
t3 = v;
}
return t4;
}
t4 = v;
}
return t5;
}
t5 = v;
}
return t6;
}
t6 = v;
}
return t7;
}
t7 = v;
}
return t8;
}
t8 = v;
}
return t9;
}
t9 = v;
}
return t10;
}
t10 = v;
}
return t11;
}
t11 = v;
}
return t12;
}
t12 = v;
}
}
int error = 0;
try {
// Instantiate the MBean server
//
echo("\n>>> Create the MBean server");
// Get default domain
//
echo("\n>>> Get the MBean server's default domain");
// Register TestMXBean
//
echo("\n>>> Register TestMXBean");
// Create an RMI connector server
//
echo("\n>>> Create an RMI connector server");
cs =
// Start the RMI connector server
//
echo("\n>>> Start the RMI connector server");
// Create an RMI connector client
//
echo("\n>>> Create an RMI connector client");
// Create TestMXBean proxy
//
echo("\n>>> Create the TestMXBean proxy");
// Play with proxy getters and setters
//
echo("\n>>> Play with proxy getters and setters");
String r;
echo("\tR1 = " + r);
echo("\tR2 = " + r);
echo("\tR3 = " + r);
echo("\tR4 = " + r);
echo("\tR5 = " + r);
echo("\tR6 = " + r);
echo("\tR7 = " + r);
echo("\tR8 = " + r);
echo("\tR9 = " + r);
r = ((MonitorInfo[])((List<MonitorInfo[]>)((Set<List<MonitorInfo[]>>)test.getT10()).iterator().next()).get(0))[0].getClassName();
echo("\tR10 = " + r);
r = ((String[])((List<String[]>)((Set<List<String[]>>)((Map<String,Set<List<String[]>>>)test.getT11()).get("key")).iterator().next()).get(0))[0];
echo("\tR11 = " + r);
r = ((MonitorInfo[])((List<MonitorInfo[]>)((Set<List<MonitorInfo[]>>)((Map<String,Set<List<MonitorInfo[]>>>)test.getT12()).get("key")).iterator().next()).get(0))[0].getClassName();
echo("\tR12 = " + r);
} catch (Exception e) {
error++;
} finally {
// Close client
//
echo("\n>>> Close the RMI connector client");
// Stop server
//
echo("\n>>> Stop the RMI connector server");
echo("\n>>> Bye! Bye!");
}
if (error > 0) {
throw new IllegalArgumentException("Test failed");
} else {
echo("\nTest passed!\n");
}
}
}
}