4375N/A/*
4375N/A * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
4375N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4375N/A *
4375N/A * This code is free software; you can redistribute it and/or modify it
4375N/A * under the terms of the GNU General Public License version 2 only, as
4375N/A * published by the Free Software Foundation.
4375N/A *
4375N/A * This code is distributed in the hope that it will be useful, but WITHOUT
4375N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4375N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4375N/A * version 2 for more details (a copy is included in the LICENSE file that
4375N/A * accompanied this code).
4375N/A *
4375N/A * You should have received a copy of the GNU General Public License version
4375N/A * 2 along with this work; if not, write to the Free Software Foundation,
4375N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4375N/A *
4375N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4375N/A * or visit www.oracle.com if you need additional information or have any
4375N/A * questions.
4375N/A */
4375N/A
4375N/A/*
4375N/A * @test
4375N/A * @bug 6832374 7052898
4375N/A * @summary Test bad signatures get a GenericSignatureFormatError thrown.
4375N/A * @author Joseph D. Darcy
4375N/A */
4375N/A
4375N/Aimport java.lang.reflect.*;
4375N/Aimport sun.reflect.generics.parser.SignatureParser;
4375N/A
4375N/Apublic class TestBadSignatures {
4375N/A public static void main(String[] args) {
4375N/A String[] badSignatures = {
4375N/A // Missing ":" after first type bound
4375N/A "<T:Lfoo/tools/nsc/symtab/Names;Lfoo/tools/nsc/symtab/Symbols;",
4375N/A
4375N/A // Arrays improperly indicated for exception information
4375N/A "<E:Ljava/lang/Exception;>(TE;[Ljava/lang/RuntimeException;)V^[TE;",
4375N/A };
4375N/A
4375N/A for(String badSig : badSignatures) {
4375N/A try {
4375N/A SignatureParser.make().parseMethodSig(badSig);
4375N/A throw new RuntimeException("Expected GenericSignatureFormatError for " +
4375N/A badSig);
4375N/A } catch(GenericSignatureFormatError gsfe) {
4375N/A System.out.println(gsfe.toString()); // Expected
4375N/A }
4375N/A }
4375N/A }
4375N/A}