< prev index next >

test/java/lang/Class/GenericStringTest.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,7 ---- /* ! * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 32,45 **** import java.lang.annotation.*; import java.util.*; @ExpectedGenericString("public class GenericStringTest") public class GenericStringTest { ! public static void main(String... args){ int failures = 0; failures += checkToGenericString(int.class, "int"); Class<?>[] types = { GenericStringTest.class, AnInterface.class, LocalMap.class, --- 32,61 ---- import java.lang.annotation.*; import java.util.*; @ExpectedGenericString("public class GenericStringTest") public class GenericStringTest { ! public Map<String, Integer>[] mixed = null; ! ! public static void main(String... args) throws ReflectiveOperationException { int failures = 0; + String[][] nested = {{""}}; + int[][] intArray = {{1}}; + failures += checkToGenericString(int.class, "int"); + failures += checkToGenericString(void.class, "void"); + failures += checkToGenericString(args.getClass(), "java.lang.String[]"); + failures += checkToGenericString(nested.getClass(), "java.lang.String[][]"); + failures += checkToGenericString(intArray.getClass(), "int[][]"); + failures += checkToGenericString(java.util.Map.class, "public abstract interface java.util.Map<K,V>"); + + Field f = GenericStringTest.class.getDeclaredField("mixed"); + // The expected value includes "<K,V>" rather than + // "<...String,...Integer>" since the Class object rather than + // Type objects is being queried. + failures += checkToGenericString(f.getType(), "java.util.Map<K,V>[]"); Class<?>[] types = { GenericStringTest.class, AnInterface.class, LocalMap.class,
< prev index next >