check_class.c.template revision 0
325N/A * Copyright 2002 Sun Microsystems, Inc. All Rights Reserved. 325N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 325N/A * This code is free software; you can redistribute it and/or modify it 325N/A * under the terms of the GNU General Public License version 2 only, as 325N/A * published by the Free Software Foundation. Sun designates this 325N/A * particular file as subject to the "Classpath" exception as provided 325N/A * by Sun in the LICENSE file that accompanied this code. 325N/A * This code is distributed in the hope that it will be useful, but WITHOUT 325N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 325N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 325N/A * version 2 for more details (a copy is included in the LICENSE file that 325N/A * accompanied this code). 325N/A * You should have received a copy of the GNU General Public License version 325N/A * 2 along with this work; if not, write to the Free Software Foundation, 325N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 325N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 325N/A * CA 95054 USA or visit www.sun.com if you need additional information or 325N/A/* This file was generated AUTOMATICALLY from a template file Wed Jun 17 10:43:47 PDT 1998 */ 325N/A * code for verifying the date in a ClassClass structure for internal 325N/A/* Argument for is_legal_fieldname */ 325N/A /* Make sure all the method names and signatures are okay */ 325N/A /* Make sure all the field names and signatures are okay */ 325N/A /* Make sure we are not overriding any final methods or classes*/ /* Only internal methods can be static */ CCerror(
cb,
"Illegal static method %s in interface %s",
CCerror(
cb,
"Class %s is subclass of final class %s",
CCerror(
cb,
"Class %s overrides final method %s.%s",
if (
cp_count ==
0)
/* Primitive classes */ /* Let's make two quick passes over the constant pool. The first one * checks that everything is of the right type. */ CCerror(
cb,
"Bad index in constant pool #%d", i);
/* This can only happen if a string is the "initial" value of * some final static String. We assume that the checking has CCerror(
cb,
"Bad index in constant pool #%d", i);
CCerror(
cb,
"Bad index in constant pool #%d", i);
CCerror(
cb,
"Improperly resolved constant pool #%d", i);
CCerror(
cb,
"Improperly unresolved constant pool #%d", i);
CCerror(
cb,
"Illegal constant pool type at #%d", i);
/* Return true if the entire second argument consists of a legal fieldname * (or classname, if the third argument is LegalClass). result = (p !=
0 && p[
0] ==
'\0');
/* Return true if the entire string consists of a legal field signature */ if (p !=
0 && p[
0] ==
'\0') {
CCerror(
cb,
"Field \"%s\" has illegal signature \"%s\"",
/* The first character must be a '(' */ /* Skip over however many legal field signatures there are */ /* The first non-signature thing better be a ')' */ /* All internal methods must return void */ /* Now, we better just have a return value. */ CCerror(
cb,
"Method \"%s\" has illegal signature \"%s\"",
* This code mirrors Character.isJavaIdentifierStart. It determines whether * the specified character is a legal start of a Java identifier as per JLS. * The parameter ch is the character to be tested; return 1 if the * character is a letter, 0 otherwise. * This code mirrors Character.isJavaIdentifierPart. It determines whether * the specified character is a legal part of a Java identifier as per JLS. * The parameter ch is the character to be tested; return 1 if the * character is a digit, 0 otherwise. /* Take pointer to a string. Skip over the longest part of the string that * could be taken as a fieldname. Allow '/' if slash_okay is TRUE. * Return a pointer to just past the fieldname. Return NULL if no fieldname * at all was found, or in the case of slash_okay being true, we saw * consecutive slashes (meaning we were looking for a qualified path but * found something that was badly-formed). ||
ch ==
'_' ||
ch ==
'$') {
return 0;
/* Don't permit consecutive slashes */ /* Take pointer to a string. Skip over the longest part of the string that * could be taken as a field signature. Allow "void" if void_okay. * Return a pointer to just past the signature. Return NULL if no legal /* Skip over the classname, if one is there. */ /* The next character better be a semicolon. */ /* The rest of what's there better be a legal signature. */ /* For use from outside the file. Determine if the specified name is legal * UTF name for a classname. * Note that this routine expects the internal form of qualified classes: * the dots should have been replaced by slashes. /* Everything that's left better be a field signature */ /* skip over the fieldname. Slashes are okay */ return (p !=
0 && p[
0] ==
'\0');