« Return to Thread: SF.net SVN: jikesrvm:[15700] rvmroot/trunk/libraryInterface/Common/src/java /lang

SF.net SVN: jikesrvm:[15700] rvmroot/trunk/libraryInterface/Common/src/java /lang

by pizlo :: Rate this Message:

Reply to Author | View in Thread

Revision: 15700
          http://jikesrvm.svn.sourceforge.net/jikesrvm/?rev=15700&view=rev
Author:   pizlo
Date:     2009-06-01 00:19:26 +0000 (Mon, 01 Jun 2009)

Log Message:
-----------
fix for RVM-814, courtesy of Byeong Lee

Modified Paths:
--------------
    rvmroot/trunk/libraryInterface/Common/src/java/lang/Class.java
    rvmroot/trunk/libraryInterface/Common/src/java/lang/reflect/VMCommonLibrarySupport.java

Modified: rvmroot/trunk/libraryInterface/Common/src/java/lang/Class.java
===================================================================
--- rvmroot/trunk/libraryInterface/Common/src/java/lang/Class.java 2009-05-31 23:57:04 UTC (rev 15699)
+++ rvmroot/trunk/libraryInterface/Common/src/java/lang/Class.java 2009-06-01 00:19:26 UTC (rev 15700)
@@ -834,7 +834,7 @@
 
   @Inline(value=Inline.When.ArgumentsAreConstant, arguments={0})
   public T newInstance() throws IllegalAccessException, InstantiationException,
-    InvocationTargetException, ExceptionInInitializerError, SecurityException {
+    ExceptionInInitializerError, SecurityException {
 
     // Basic checks
     checkMemberAccess(Member.PUBLIC);
@@ -867,7 +867,14 @@
     T obj = (T)RuntimeEntrypoints.resolvedNewScalar(cls);
 
     // Run the default constructor on the it.
-    Reflection.invoke(defaultConstructor, null, obj, null, true);
+    try {
+      Reflection.invoke(defaultConstructor, null, obj, null, true);
+    } catch(InvocationTargetException e) {
+      // This suppresses compiler checking for the InvokeTargetException.
+      // Note that JDk 1.6 does not declare the InvokeTargetException for the newInstance
+      // method of the java.lang.Class.
+      RuntimeEntrypoints.athrow(e.getCause());
+    }
 
     return obj;
   }

Modified: rvmroot/trunk/libraryInterface/Common/src/java/lang/reflect/VMCommonLibrarySupport.java
===================================================================
--- rvmroot/trunk/libraryInterface/Common/src/java/lang/reflect/VMCommonLibrarySupport.java 2009-05-31 23:57:04 UTC (rev 15699)
+++ rvmroot/trunk/libraryInterface/Common/src/java/lang/reflect/VMCommonLibrarySupport.java 2009-06-01 00:19:26 UTC (rev 15700)
@@ -199,11 +199,7 @@
     }
 
     // Invoke method
-    try {
-      return Reflection.invoke(method, invoker, receiver, args, true);
-    } catch (Throwable t) {
-      throw new InvocationTargetException(t);
-    }
+    return Reflection.invoke(method, invoker, receiver, args, true);
   }
 
   @Inline(value=Inline.When.ArgumentsAreConstant, arguments={2})
@@ -229,11 +225,7 @@
     method = C.findVirtualMethod(method.getName(), method.getDescriptor());
 
     // Invoke method
-    try {
-      return Reflection.invoke(method, invoker, receiver, args, false);
-    } catch (Throwable t) {
-      throw new InvocationTargetException(t);
-    }
+    return Reflection.invoke(method, invoker, receiver, args, false);
   }
 
   @Inline(value=Inline.When.ArgumentsAreConstant, arguments={1})
@@ -432,11 +424,7 @@
     // Allocate an uninitialized instance;
     Object obj = RuntimeEntrypoints.resolvedNewScalar(cls);
     // Run the constructor on the instance.
-    try {
-      Reflection.invoke(constructor, invoker, obj, args, true);
-    } catch (Throwable e) {
-      throw new InvocationTargetException(e);
-    }
+    Reflection.invoke(constructor, invoker, obj, args, true);
     return obj;
   }
   /* ---- Constructor/Method Support ---- */


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, &
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
_______________________________________________
Jikesrvm-commits mailing list
Jikesrvm-commits@...
https://lists.sourceforge.net/lists/listinfo/jikesrvm-commits

 « Return to Thread: SF.net SVN: jikesrvm:[15700] rvmroot/trunk/libraryInterface/Common/src/java /lang