Coding_Conventions - nimakarimipour/WALAWiki GitHub Wiki
title: Coding Conventions permalink: /Coding_Conventions/
- Normal Sun-style Java coding conventions, with 2-space indenting
and 132 columns. Please indent with two spaces and don't use
tabs. If using Eclipse, you can import the following coding styles
codeTemplates.xml
andformatter.xml
from thedat/
directory ofcom.ibm.wala.core
. - Be extremely liberal with comments and javadoc.
- All code must compile against JDK 5.0.
- No code should ever write to
System.out
orSystem.err
. Use thecom.ibm.wala.util.debug.Trace
facility to write debugging and trace messages. - Use the
com.ibm.wala.util.debug.Assertions
class liberally. All calls toassert()
must be guarded byAssertions.verifyAssertions
. Use theproductionAssert
entrypoints for assertions that should be enabled in production, and thus not guarded. - Do not explicitly throw exceptions or errors ... any such conditions
should be redirected through the
Assertions
class .. such asAssertions.UNREACHABLE()
. - All Eclipse code should work with Eclipse 3.3.
- All code should be deterministic if possible ... avoid
System.identityHashCode
and finalizers. - Any shortcuts, assumptions, or analysis problems should be recorded
in the static
Warnings
dictionary. Assertions.verifyAssertions
should be true in HEAD until further notice.- Each Java file should have a header similar to the one below. You do not have to assign the copyright to IBM. However if you want to, feel free.
Template for Java file header
/*******************************************************************************
* Copyright (c) 2002 - 2006 IBM Corporation
* [Or Copyright(c) 200x Your name]
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
*
http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
* OR your name.
*******************************************************************************/