Style and Compliance - prismmodelchecker/prism GitHub Wiki

Java version

Much of PRISM's codebase is in Java. We currently assume compliance with Java 11. Prior to that, we assumed: Java 9 (up until version 4.10.1), Java 8 (up until version 4.6), Java 7 (up until version 4.3.1) and Java 6 (up until version 4.2).

Code formatting

Most of PRISM's more recent Java code sticks to a consistent formatting style. This is usually deployed using Eclipse's code automatic formatting functionality. The configuration file is prism-eclipse-formatter.xml which can be found in the prism/etc subdirectory. As described in "Setting Up Eclipse" to install it, go to "Java | Code Style | Formatting" in the Eclipse preferences, click "Import..." and then select the file.

Here's a fragment of code from the Eclipse configuration, illustrating the style:

/**
* Indentation
*/
class Example
{
	int[] myArray = { 1, 2, 3, 4, 5, 6 };
	int theInt = 1;
	String someString = "Hello";
	double aDouble = 3.0;

	void foo(int a, int b, int c, int d, int e, int f)
	{
		switch (a) {
		case 0:
			Other.doFoo();
			break;
		default:
			Other.doBaz();
		}
	}

	void bar(List v)
	{
		for (int i = 0; i < 10; i++) {
			v.add(new Integer(i));
		}
	}
}

enum MyEnum {
	UNDEFINED(0) {
		void foo()
		{
		}
	}
}

@interface MyAnnotation {
	int count() default 1;
}