2362N/A * Copyright (c) 1994, 2004, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * Batch file parser, this needs more work. 0N/A * WARNING: The contents of this source file are not part of any 0N/A * supported API. Code that depends on them does so at its own risk: 0N/A * they are subject to change or removal without notice. 0N/A * The current package 0N/A * The current imports 0N/A * The classes defined in this file 0N/A * The toplevel environment 0N/A * Create a batch file parser 0N/A * Package declaration 0N/A //System.out.println("package " + nm); 0N/A // This code has been changed to pass an IdentifierToken, 0N/A // rather than an Identifier, to setCurrentPackage(). Imports 0N/A // now needs the location of the token. 0N/A //System.out.println("import class " + t); 0N/A //System.out.println("import package " + t); 0N/A // If this class is nested, the modifier bits set here will 0N/A // be copied into the 'SourceMember' object for the inner class 0N/A // created during the call to 'makeClassDefinition' below. 0N/A // When writing the class file, we will look there for the 0N/A // 'untransformed' modifiers. The modifiers in the ClassDefinition 0N/A // object will end up as the 'transformed' modifiers. Note that 0N/A // there are some bits set here that are not legal class modifiers 0N/A // according to the JVMS, e.g., M_PRIVATE and M_STATIC. These are 0N/A // masked off while writing the class file, but are preserved in 0N/A // the InnerClasses attributes. 0N/A // The defaults for anonymous and local classes should be documented! 0N/A // Certain modifiers are implied as follows: 0N/A // 1. Any interface (nested or not) is implicitly deemed to be abstract, 0N/A // whether it is explicitly marked so or not. (Java 1.0.) 0N/A // 2. A interface which is a member of a type is implicitly deemed to 0N/A // be static, whether it is explicitly marked so or not. (InnerClasses) 0N/A // 3a. A type which is a member of an interface is implicitly deemed 0N/A // to be public, whether it is explicitly marked so or not. (InnerClasses) 0N/A // 3b. A type which is a member of an interface is implicitly deemed 0N/A // to be static, whether it is explicitly marked so or not. (InnerClasses) 0N/A // For interface members, neither 'private' nor 'protected' 0N/A // are legal modifiers. We avoid setting M_PUBLIC in some 0N/A // cases in order to avoid interfering with error detection 0N/A // and reporting. This is patched up, after reporting an 0N/A // error, by 'SourceClass.addMember'. 0N/A // For nested classes, we must transform 'protected' to 'public' 0N/A // and 'private' to package scope. This must be done later, 0N/A // because any modifiers set here will be copied into the 0N/A // 'MemberDefinition' for the nested class, which must represent 0N/A // the original untransformed modifiers. Also, compile-time 0N/A // checks should be performed against the actual, untransformed 0N/A // modifiers. This is in contrast to transformations that implement 0N/A // implicit modifiers, such as M_STATIC and M_FINAL for fields 0N/A // The code which adds artificial dependencies between 0N/A // classes in the same source file has been moved to 0N/A // BatchEnvironment#parseFile(). 0N/A * Report the current class under construction. 0N/A // c == sourceClass; don't bother to check 0N/A // c == sourceClass; don't bother to check 0N/A // Members that are nested classes are not created with 'defineField', 0N/A // so these transformations do not apply to them. See 'beginClass' above. 0N/A // Members of interfaces are implicitly public. 0N/A // For interface members, neither 'private' nor 'protected' 0N/A // are legal modifiers. Avoid setting M_PUBLIC in some cases 0N/A // to avoid interfering with later error detection. This will 0N/A // be fixed up after the error is reported. 0N/A // Methods of interfaces are implicitly abstract. 0N/A // Fields of interfaces are implicitly static and final. 0N/A // The parser reports "idInit" when in reality it has found 0N/A // that there is no method name at all present. 0N/A // So, decide if it's really a constructor, or a syntax error. 0N/A // It appears to be a constructor with spurious qualification. 0N/A // It appears to be a type name with no method name. 0N/A // We assume the type name is missing, even though the 0N/A // simple name that's present might have been intended 0N/A // to be a type: "String (){}" vs. "toString(){}".