Java Code Examples for com.sun.jdi.ClassType#newInstance()

The following examples show how to use com.sun.jdi.ClassType#newInstance() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OomDebugTest.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
@SuppressWarnings("unused") // called via reflection
private void test1() throws Exception {
    System.out.println("DEBUG: ------------> Running test1");
    try {
        Field field = targetClass.fieldByName("fooCls");
        ClassType clsType = (ClassType)field.type();
        Method constructor = getConstructorForClass(clsType);
        for (int i = 0; i < 15; i++) {
            @SuppressWarnings({ "rawtypes", "unchecked" })
            ObjectReference objRef = clsType.newInstance(mainThread,
                                                         constructor,
                                                         new ArrayList(0),
                                                         ObjectReference.INVOKE_NONVIRTUAL);
            if (objRef.isCollected()) {
                System.out.println("DEBUG: Object got GC'ed before we can use it. NO-OP.");
                continue;
            }
            invoke("testMethod", "(LOomDebugTestTarget$FooCls;)V", objRef);
        }
    } catch (InvocationException e) {
        handleFailure(e);
    }
}
 
Example 2
Source File: OomDebugTest.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@SuppressWarnings("unused") // called via reflection
private void test1() throws Exception {
    System.out.println("DEBUG: ------------> Running test1");
    try {
        Field field = targetClass.fieldByName("fooCls");
        ClassType clsType = (ClassType)field.type();
        Method constructor = getConstructorForClass(clsType);
        for (int i = 0; i < 15; i++) {
            @SuppressWarnings({ "rawtypes", "unchecked" })
            ObjectReference objRef = clsType.newInstance(mainThread,
                                                         constructor,
                                                         new ArrayList(0),
                                                         ObjectReference.INVOKE_NONVIRTUAL);
            if (objRef.isCollected()) {
                System.out.println("DEBUG: Object got GC'ed before we can use it. NO-OP.");
                continue;
            }
            invoke("testMethod", "(LOomDebugTestTarget$FooCls;)V", objRef);
        }
    } catch (InvocationException e) {
        handleFailure(e);
    }
}
 
Example 3
Source File: OomDebugTest.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
@SuppressWarnings("unused") // called via reflection
private void test1() throws Exception {
    System.out.println("DEBUG: ------------> Running test1");
    try {
        Field field = targetClass.fieldByName("fooCls");
        ClassType clsType = (ClassType)field.type();
        Method constructor = getConstructorForClass(clsType);
        for (int i = 0; i < 15; i++) {
            @SuppressWarnings({ "rawtypes", "unchecked" })
            ObjectReference objRef = clsType.newInstance(mainThread,
                                                         constructor,
                                                         new ArrayList(0),
                                                         ObjectReference.INVOKE_NONVIRTUAL);
            if (objRef.isCollected()) {
                System.out.println("DEBUG: Object got GC'ed before we can use it. NO-OP.");
                continue;
            }
            invoke("testMethod", "(LOomDebugTestTarget$FooCls;)V", objRef);
        }
    } catch (InvocationException e) {
        handleFailure(e);
    }
}
 
Example 4
Source File: OomDebugTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
@SuppressWarnings("unused") // called via reflection
private void test1() throws Exception {
    System.out.println("DEBUG: ------------> Running test1");
    try {
        Field field = targetClass.fieldByName("fooCls");
        ClassType clsType = (ClassType)field.type();
        Method constructor = getConstructorForClass(clsType);
        for (int i = 0; i < 15; i++) {
            @SuppressWarnings({ "rawtypes", "unchecked" })
            ObjectReference objRef = clsType.newInstance(mainThread,
                                                         constructor,
                                                         new ArrayList(0),
                                                         ObjectReference.INVOKE_NONVIRTUAL);
            if (objRef.isCollected()) {
                System.out.println("DEBUG: Object got GC'ed before we can use it. NO-OP.");
                continue;
            }
            invoke("testMethod", "(LOomDebugTestTarget$FooCls;)V", objRef);
        }
    } catch (InvocationException e) {
        handleFailure(e);
    }
}
 
Example 5
Source File: OomDebugTest.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@SuppressWarnings("unused") // called via reflection
private void test1() throws Exception {
    System.out.println("DEBUG: ------------> Running test1");
    try {
        Field field = targetClass.fieldByName("fooCls");
        ClassType clsType = (ClassType)field.type();
        Method constructor = getConstructorForClass(clsType);
        for (int i = 0; i < 15; i++) {
            @SuppressWarnings({ "rawtypes", "unchecked" })
            ObjectReference objRef = clsType.newInstance(mainThread,
                                                         constructor,
                                                         new ArrayList(0),
                                                         ObjectReference.INVOKE_NONVIRTUAL);
            if (objRef.isCollected()) {
                System.out.println("DEBUG: Object got GC'ed before we can use it. NO-OP.");
                continue;
            }
            invoke("testMethod", "(LOomDebugTestTarget$FooCls;)V", objRef);
        }
    } catch (InvocationException e) {
        handleFailure(e);
    }
}
 
Example 6
Source File: OomDebugTest.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
@SuppressWarnings("unused") // called via reflection
private void test1() throws Exception {
    System.out.println("DEBUG: ------------> Running test1");
    try {
        Field field = targetClass.fieldByName("fooCls");
        ClassType clsType = (ClassType)field.type();
        Method constructor = getConstructorForClass(clsType);
        for (int i = 0; i < 15; i++) {
            @SuppressWarnings({ "rawtypes", "unchecked" })
            ObjectReference objRef = clsType.newInstance(mainThread,
                                                         constructor,
                                                         new ArrayList(0),
                                                         ObjectReference.INVOKE_NONVIRTUAL);
            if (objRef.isCollected()) {
                System.out.println("DEBUG: Object got GC'ed before we can use it. NO-OP.");
                continue;
            }
            invoke("testMethod", "(LOomDebugTestTarget$FooCls;)V", objRef);
        }
    } catch (InvocationException e) {
        handleFailure(e);
    }
}
 
Example 7
Source File: OomDebugTest.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
@SuppressWarnings("unused") // called via reflection
private void test1() throws Exception {
    System.out.println("DEBUG: ------------> Running " + testMethodName);
    try {
        Field field = targetClass.fieldByName("fooCls");
        ClassType clsType = (ClassType)field.type();
        Method constructor = getConstructorForClass(clsType);
        for (int i = 0; i < 15; i++) {
            @SuppressWarnings({ "rawtypes", "unchecked" })
            ObjectReference objRef = clsType.newInstance(mainThread,
                                                         constructor,
                                                         new ArrayList(0),
                                                         ObjectReference.INVOKE_NONVIRTUAL);
            invoke("testMethod", "(LOomDebugTestTarget$FooCls;)V", objRef);
        }
    } catch (InvocationException e) {
        handleFailure(e);
    }
}
 
Example 8
Source File: OomDebugTest.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
@SuppressWarnings("unused") // called via reflection
private void test1() throws Exception {
    System.out.println("DEBUG: ------------> Running test1");
    try {
        Field field = targetClass.fieldByName("fooCls");
        ClassType clsType = (ClassType)field.type();
        Method constructor = getConstructorForClass(clsType);
        for (int i = 0; i < 15; i++) {
            @SuppressWarnings({ "rawtypes", "unchecked" })
            ObjectReference objRef = clsType.newInstance(mainThread,
                                                         constructor,
                                                         new ArrayList(0),
                                                         ObjectReference.INVOKE_NONVIRTUAL);
            if (objRef.isCollected()) {
                System.out.println("DEBUG: Object got GC'ed before we can use it. NO-OP.");
                continue;
            }
            invoke("testMethod", "(LOomDebugTestTarget$FooCls;)V", objRef);
        }
    } catch (InvocationException e) {
        handleFailure(e);
    }
}
 
Example 9
Source File: OomDebugTest.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings({ "unused", "unchecked", "rawtypes" }) // called via reflection
private void test5() throws Exception {
    System.out.println("DEBUG: ------------> Running test5");
    try {
        ClassType type = (ClassType)thisObject.type();
        for (int i = 0; i < 15; i++) {
            type.newInstance(mainThread,
                             findMethod(targetClass, "<init>", "()V"),
                             new ArrayList(0),
                             ObjectReference.INVOKE_NONVIRTUAL);
        }
    } catch (InvocationException e) {
        handleFailure(e);
    }
}
 
Example 10
Source File: OomDebugTest.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings({ "unused", "unchecked", "rawtypes" }) // called via reflection
private void test5() throws Exception {
    System.out.println("DEBUG: ------------> Running test5");
    try {
        ClassType type = (ClassType)thisObject.type();
        for (int i = 0; i < 15; i++) {
            type.newInstance(mainThread,
                             findMethod(targetClass, "<init>", "()V"),
                             new ArrayList(0),
                             ObjectReference.INVOKE_NONVIRTUAL);
        }
    } catch (InvocationException e) {
        handleFailure(e);
    }
}
 
Example 11
Source File: OomDebugTest.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings({ "unused", "unchecked", "rawtypes" }) // called via reflection
private void test5() throws Exception {
    System.out.println("DEBUG: ------------> Running test5");
    try {
        ClassType type = (ClassType)thisObject.type();
        for (int i = 0; i < 15; i++) {
            type.newInstance(mainThread,
                             findMethod(targetClass, "<init>", "()V"),
                             new ArrayList(0),
                             ObjectReference.INVOKE_NONVIRTUAL);
        }
    } catch (InvocationException e) {
        handleFailure(e);
    }
}
 
Example 12
Source File: OomDebugTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings({ "unused", "unchecked", "rawtypes" }) // called via reflection
private void test5() throws Exception {
    System.out.println("DEBUG: ------------> Running test5");
    try {
        ClassType type = (ClassType)thisObject.type();
        for (int i = 0; i < 15; i++) {
            type.newInstance(mainThread,
                             findMethod(targetClass, "<init>", "()V"),
                             new ArrayList(0),
                             ObjectReference.INVOKE_NONVIRTUAL);
        }
    } catch (InvocationException e) {
        handleFailure(e);
    }
}
 
Example 13
Source File: OomDebugTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings({ "unused", "unchecked", "rawtypes" }) // called via reflection
private void test5() throws Exception {
    System.out.println("DEBUG: ------------> Running test5");
    try {
        ClassType type = (ClassType)thisObject.type();
        for (int i = 0; i < 15; i++) {
            type.newInstance(mainThread,
                             findMethod(targetClass, "<init>", "()V"),
                             new ArrayList(0),
                             ObjectReference.INVOKE_NONVIRTUAL);
        }
    } catch (InvocationException e) {
        handleFailure(e);
    }
}
 
Example 14
Source File: OomDebugTest.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings({ "unused", "unchecked", "rawtypes" }) // called via reflection
private void test5() throws Exception {
    System.out.println("DEBUG: ------------> Running test5");
    try {
        ClassType type = (ClassType)thisObject.type();
        for (int i = 0; i < 15; i++) {
            type.newInstance(mainThread,
                             findMethod(targetClass, "<init>", "()V"),
                             new ArrayList(0),
                             ObjectReference.INVOKE_NONVIRTUAL);
        }
    } catch (InvocationException e) {
        handleFailure(e);
    }
}
 
Example 15
Source File: OomDebugTest.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings({ "unused", "unchecked", "rawtypes" }) // called via reflection
private void test5() throws Exception {
    System.out.println("DEBUG: ------------> Running " + testMethodName);
    try {
        ClassType type = (ClassType)thisObject.type();
        for (int i = 0; i < 15; i++) {
            type.newInstance(mainThread,
                             findMethod(targetClass, "<init>", "()V"),
                             new ArrayList(0),
                             ObjectReference.INVOKE_NONVIRTUAL);
        }
    } catch (InvocationException e) {
        handleFailure(e);
    }
}
 
Example 16
Source File: OomDebugTest.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings({ "unused", "unchecked", "rawtypes" }) // called via reflection
private void test5() throws Exception {
    System.out.println("DEBUG: ------------> Running test5");
    try {
        ClassType type = (ClassType)thisObject.type();
        for (int i = 0; i < 15; i++) {
            type.newInstance(mainThread,
                             findMethod(targetClass, "<init>", "()V"),
                             new ArrayList(0),
                             ObjectReference.INVOKE_NONVIRTUAL);
        }
    } catch (InvocationException e) {
        handleFailure(e);
    }
}