コード例 #1
0
ファイル: VMMethod.java プロジェクト: luiseduardohdbackup/mrp
 Class<?>[] getExceptionTypes() {
   TypeReference[] exceptionTypes = method.getExceptionTypes();
   if (exceptionTypes == null) {
     return new Class[0];
   } else {
     return VMCommonLibrarySupport.typesToClasses(exceptionTypes);
   }
 }
コード例 #2
0
ファイル: Class.java プロジェクト: abhijangda/JikesRVM
  @Inline(
      value = Inline.When.ArgumentsAreConstant,
      arguments = {0})
  public T newInstance()
      throws IllegalAccessException, InstantiationException, ExceptionInInitializerError,
          SecurityException {

    // Basic checks
    checkMemberAccess(Member.PUBLIC);
    if (!type.isClassType()) throw new InstantiationException();

    RVMClass cls = type.asClass();

    if (cls.isAbstract() || cls.isInterface()) throw new InstantiationException();

    // Ensure that the class is initialized
    if (!cls.isInitialized()) {
      RuntimeEntrypoints.initializeClassForDynamicLink(cls);
    }

    // Find the defaultConstructor
    RVMMethod defaultConstructor = getDefaultConstructor();
    if (defaultConstructor == null) throw new InstantiationException();

    // Check that caller is allowed to access it
    if (!defaultConstructor.isPublic()) {
      RVMClass accessingClass = RVMClass.getClassFromStackFrame(1);
      VMCommonLibrarySupport.checkAccess(defaultConstructor, accessingClass);
    }

    // Allocate an uninitialized instance;
    @SuppressWarnings("unchecked") // yes, we're giving an anonymous object a type.
    T obj = (T) RuntimeEntrypoints.resolvedNewScalar(cls);

    // Run the default constructor on the it.
    Reflection.invoke(defaultConstructor, null, obj, null, true);

    return obj;
  }
コード例 #3
0
ファイル: VMField.java プロジェクト: luiseduardohdbackup/mrp
 public short getShort(Field f, Object object)
     throws IllegalAccessException, IllegalArgumentException {
   return VMCommonLibrarySupport.getShort(object, field, f, RVMClass.getClassFromStackFrame(2));
 }
コード例 #4
0
ファイル: VMField.java プロジェクト: luiseduardohdbackup/mrp
 void setShort(Field f, Object object, short value)
     throws IllegalAccessException, IllegalArgumentException {
   VMCommonLibrarySupport.setShort(object, value, field, f, RVMClass.getClassFromStackFrame(2));
 }
コード例 #5
0
ファイル: VMMethod.java プロジェクト: luiseduardohdbackup/mrp
 Object invoke(Object receiver, Object[] args, Method m)
     throws IllegalAccessException, IllegalArgumentException, ExceptionInInitializerError,
         InvocationTargetException {
   return VMCommonLibrarySupport.invoke(
       receiver, args, method, m, RVMClass.getClassFromStackFrame(2), invoker);
 }
コード例 #6
0
ファイル: VMMethod.java プロジェクト: luiseduardohdbackup/mrp
 Class<?>[] getParameterTypes() {
   return VMCommonLibrarySupport.typesToClasses(method.getParameterTypes());
 }