Give the hosted mode JavaScriptObject implementation class a public constructor so it can be instantiated without violating access.

Review by: spoon

git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@6051 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/dev/core/src/com/google/gwt/dev/shell/JsValueGlue.java b/dev/core/src/com/google/gwt/dev/shell/JsValueGlue.java
index f8e8e79..927c341 100644
--- a/dev/core/src/com/google/gwt/dev/shell/JsValueGlue.java
+++ b/dev/core/src/com/google/gwt/dev/shell/JsValueGlue.java
@@ -214,7 +214,6 @@
       // Instantiate the JSO class.
       Class<?> jsoType = Class.forName(JSO_IMPL_CLASS, true, classLoader);
       Constructor<?> ctor = jsoType.getDeclaredConstructor();
-      ctor.setAccessible(true);
       jso = ctor.newInstance();
 
       // Set the reference field to this JsValue using reflection.
diff --git a/dev/core/src/com/google/gwt/dev/shell/rewrite/WriteJsoImpl.java b/dev/core/src/com/google/gwt/dev/shell/rewrite/WriteJsoImpl.java
index 4adf11c..1054421 100644
--- a/dev/core/src/com/google/gwt/dev/shell/rewrite/WriteJsoImpl.java
+++ b/dev/core/src/com/google/gwt/dev/shell/rewrite/WriteJsoImpl.java
@@ -94,6 +94,17 @@
       }
     }
 
+    @Override
+    public MethodVisitor visitMethod(int access, String name, String desc,
+        String signature, String[] exceptions) {
+      if (isCtor(name)) {
+        // make the JavaScriptObject$ constructor public
+        access &= ~(Opcodes.ACC_PRIVATE | Opcodes.ACC_PROTECTED);
+        access |= Opcodes.ACC_PUBLIC;
+      }
+      return super.visitMethod(access, name, desc, signature, exceptions);
+    }
+
     /**
      * JSO methods are implemented as flyweight style, with the instance being
      * passed as the first parameter. This loop create instance methods on JSO$