< prev index next >

test/java/io/Serializable/proxy/Basic.java

Print this page




   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /* @test
  25  * @summary Verifies basic correct functioning of proxy serialization.

  26  */
  27 
  28 import java.io.*;
  29 import java.lang.reflect.*;
  30 import java.util.Random;
  31 
  32 // proxy interfaces
  33 interface Foo { int foo(); }
  34 interface Bar { float bar(); }
  35 
  36 // dummy invocation handler
  37 class Handler implements InvocationHandler, Serializable {
  38 
  39     static Method fooMethod, barMethod;
  40     static {
  41         try {
  42             fooMethod = Foo.class.getDeclaredMethod("foo", new Class[0]);
  43             barMethod = Bar.class.getDeclaredMethod("bar", new Class[0]);
  44         } catch (NoSuchMethodException ex) {
  45             throw new Error();




   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /* @test
  25  * @summary Verifies basic correct functioning of proxy serialization.
  26  * @key randomness
  27  */
  28 
  29 import java.io.*;
  30 import java.lang.reflect.*;
  31 import java.util.Random;
  32 
  33 // proxy interfaces
  34 interface Foo { int foo(); }
  35 interface Bar { float bar(); }
  36 
  37 // dummy invocation handler
  38 class Handler implements InvocationHandler, Serializable {
  39 
  40     static Method fooMethod, barMethod;
  41     static {
  42         try {
  43             fooMethod = Foo.class.getDeclaredMethod("foo", new Class[0]);
  44             barMethod = Bar.class.getDeclaredMethod("bar", new Class[0]);
  45         } catch (NoSuchMethodException ex) {
  46             throw new Error();


< prev index next >