/* * Checks to make sure that all types in a package are defined by files in the same directory. */ private void checkPackageDirectories(Package _package) { Collection<Type> types = _package.getTypes(); Type firstType = null; File path1 = null; /* Gets the directory of the first type and compares all others to it. */ if (types.size() > 1) { for (Type type : types) { if (firstType == null) { firstType = type; path1 = typeTable.get(type).getFile().getParentFile(); } else { File path2 = typeTable.get(type).getFile().getParentFile(); if (!path1.equals(path2)) addWarning( Error.MISMATCHED_PACKAGE, "Type " + firstType + " and " + type + " both belong to package " + _package + " but are defined in different directories"); } } } // Recursively check child packages. for (Package child : _package.getChildren().values()) checkPackageDirectories(child); }