All Downloads are FREE. Search and download functionalities are using the official Maven repository.

protoj.lang.internal.PackageDependency.aj Maven / Gradle / Ivy

The newest version!
/**
 * Copyright 2009 Ashley Williams
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you
 * may not use this file except in compliance with the License. You may
 * obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
 * implied. See the License for the specific language governing
 * permissions and limitations under the License.
 */
package protoj.lang.internal;

/**
 * Enforces package dependency rules within protoj. The protoj.lang package is
 * at the top of the chain, whereas the protoj.util package is at the bottom.
 * This means that protoj.lang can see all other packages, but protoj.util
 * can't see any other package at all.
 * 
 * @author Ashley Williams
 * 
 */
public final aspect PackageDependency {
	/*
	 * The util package is considered to be bottom level, so its classes
	 * mustn't depend on other packages.
	 */
	declare error : (call(* protoj..*(..)) || call(protoj..*.new(..))) && !(call(* protoj.util..*(..)) || call(protoj.util..*.new(..)))
		&& within(protoj.util.*)
		: "bad dependency: the protoj util module is not allowed to depend on on other internal modules";

	/*
	 * The protoj.lang package is considered to be top level, so its classes
	 * mustn't be used from other packages.
	 */
	declare error : (call(protoj.lang..*.new(..)) || call(* protoj.lang..*(..)))
		&& within(protoj..*)
		&& !within(protoj.lang..*)
		: "bad dependency: no dependencies on the protoj lang module are allowed";
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy