3389N/A/*
3909N/A * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
3389N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3389N/A *
3389N/A * This code is free software; you can redistribute it and/or modify it
3389N/A * under the terms of the GNU General Public License version 2 only, as
3389N/A * published by the Free Software Foundation.
3389N/A *
3389N/A * This code is distributed in the hope that it will be useful, but WITHOUT
3389N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3389N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3389N/A * version 2 for more details (a copy is included in the LICENSE file that
3389N/A * accompanied this code).
3389N/A *
3389N/A * You should have received a copy of the GNU General Public License version
3389N/A * 2 along with this work; if not, write to the Free Software Foundation,
3389N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
3389N/A *
3389N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
3389N/A * or visit www.oracle.com if you need additional information or have any
3389N/A * questions.
3389N/A */
3389N/A
3389N/Aimport sun.misc.Version;
3389N/A
3389N/Apublic class NativeInstanceFilterTarg {
3389N/A
3389N/A public static void main(String args[]) {
3389N/A boolean runTest = jvmSupportsJVMTI_12x();
3389N/A String s1 = "abc";
3389N/A String s2 = "def";
3389N/A latch(s1);
3389N/A s1.intern();
3389N/A if (runTest) {
3389N/A s2.intern(); // this is the call that generates events that ought
3389N/A // to be filtered out.
3389N/A } else {
3389N/A System.out.println("Neutering test since JVMTI 1.2 not supported");
3389N/A }
3389N/A }
3389N/A
3389N/A // Used by debugger to get an instance to filter with
3389N/A public static String latch(String s) { return s; }
3389N/A
3389N/A public static boolean jvmSupportsJVMTI_12x() {
3389N/A // This fix requires the JVM to support JVMTI 1.2, which doesn't
3389N/A // happen until HSX 20.0, build 05.
3389N/A int major = Version.jvmMajorVersion();
3389N/A int minor = Version.jvmMinorVersion();
3389N/A int micro = Version.jvmMicroVersion();
3389N/A int build = Version.jvmBuildNumber();
3389N/A
3389N/A return (major > 20 || major == 20 &&
3389N/A (minor > 0 || micro > 0 || build >= 5));
3389N/A }
3389N/A}