1 /*******************************************************************************
2 * Copyright (c) 2000, 2003 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Common Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/cpl-v10.html
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11 package net.sourceforge.phpdt.internal.compiler.env;
14 * The name environment provides a callback API that the compiler
15 * can use to look up types, compilation units, and packages in the
16 * current environment. The name environment is passed to the compiler
19 public interface INameEnvironment {
21 * Find a type with the given compound name.
22 * Answer the binary form of the type if it is known to be consistent.
23 * Otherwise, answer the compilation unit which defines the type
24 * or null if the type does not exist.
25 * Types in the default package are specified as {{typeName}}.
27 * It is unknown whether the package containing the type actually exists.
29 * NOTE: This method can be used to find a member type using its
30 * internal name A$B, but the source file for A is answered if the binary
31 * file is inconsistent.
34 NameEnvironmentAnswer findType(char[][] compoundTypeName);
36 * Find a type named <typeName> in the package <packageName>.
37 * Answer the binary form of the type if it is known to be consistent.
38 * Otherwise, answer the compilation unit which defines the type
39 * or null if the type does not exist.
40 * The default package is indicated by char[0][].
42 * It is known that the package containing the type exists.
44 * NOTE: This method can be used to find a member type using its
45 * internal name A$B, but the source file for A is answered if the binary
46 * file is inconsistent.
49 NameEnvironmentAnswer findType(char[] typeName, char[][] packageName);
51 * Answer whether packageName is the name of a known subpackage inside
52 * the package parentPackageName. A top level package is found relative to null.
53 * The default package is always assumed to exist.
56 * isPackage({{java}, {awt}}, {event});
57 * isPackage(null, {java});
60 boolean isPackage(char[][] parentPackageName, char[] packageName);
63 * This method cleans the environment uo. It is responsible for releasing the memory
64 * and freeing resources. Passed that point, the name environment is no longer usable.
66 * A name environment can have a long life cycle, therefore it is the responsibility of
67 * the code which created it to decide when it is a good time to clean it up.