Commit f562fcff authored by Adam Knapp's avatar Adam Knapp

Could be final

Signed-off-by: Adam Knapp's avatarAdam Knapp <adam.knapp@ericsson.com>
parent 0cf5bfd6
......@@ -36,7 +36,6 @@ import org.eclipse.titan.designer.parsers.ProjectSourceParser;
*/
public final class ProjectSourceCompiler {
private final static String PACKAGE_RUNTIME_ROOT = "org.eclipse.titan.runtime.core";
public static boolean generated;
/**
* Private constructor to disable accidental instantiation.
......@@ -107,17 +106,17 @@ public final class ProjectSourceCompiler {
* @param timestamp the timestamp of this build
* @param aModule module to compile
* @param aDebug true: debug info is added to the source code
* @return whether the generation was successful or not
* @throws CoreException
*/
public static void compile(final BuildTimestamp timestamp, final Module aModule, final boolean aDebug ) throws CoreException {
generated = false;
public static boolean compile(final BuildTimestamp timestamp, final Module aModule, final boolean aDebug ) throws CoreException {
final IResource sourceFile = aModule.getLocation().getFile();
if(MarkerHandler.hasMarker(GeneralConstants.ONTHEFLY_SYNTACTIC_MARKER, sourceFile, IMarker.SEVERITY_ERROR)
|| MarkerHandler.hasMarker(GeneralConstants.ONTHEFLY_MIXED_MARKER, sourceFile)
|| MarkerHandler.hasMarker(GeneralConstants.ONTHEFLY_SEMANTIC_MARKER, sourceFile, IMarker.SEVERITY_ERROR)) {
// if there are syntactic errors in the module don't generate code for it
// TODO semantic errors need to be checked for severity
return;
return false;
}
final JavaGenData data = new JavaGenData(aModule, timestamp);
......@@ -169,14 +168,15 @@ public final class ProjectSourceCompiler {
if(needsUpdate(file, content) ) {
final InputStream outputStream = new ByteArrayInputStream( content.getBytes() );
file.setContents( outputStream, IResource.FORCE | IResource.KEEP_HISTORY, null );
generated = true;
TITANDebugConsole.println("re-Generated code for module `" + aModule.getIdentifier().getDisplayName() + "'");
return true;
}
} else {
final InputStream outputStream = new ByteArrayInputStream( content.getBytes() );
file.create( outputStream, IResource.FORCE, null );
generated = true;
return true;
}
return false;
}
/**
......
......@@ -79,8 +79,7 @@ public class TITANJavaBuilder extends IncrementalProjectBuilder {
TITANDebugConsole.println("Generating code for module `" + module.getIdentifier().getDisplayName() + "'");
try {
ProjectSourceCompiler.compile(timestamp, module, reportDebugInformation );
if (ProjectSourceCompiler.generated) {
if (ProjectSourceCompiler.compile(timestamp, module, reportDebugInformation)) {
generatedCount++;
}
} catch ( Exception e ) {
......
......@@ -37,7 +37,7 @@ public class JSON_Tokenizer {
}
/** A dummy JSON tokenizer, use when there is no actual JSON document */
public static JSON_Tokenizer DUMMY_BUFFER = new JSON_Tokenizer();
public static final JSON_Tokenizer DUMMY_BUFFER = new JSON_Tokenizer();
/** maximum number of tabs for indentation in case of pretty printing */
private static final int MAX_TABS = 64;
......
......@@ -20,7 +20,7 @@ import org.eclipse.titan.runtime.core.TTCN_Logger.Severity;
* @author Kristof Szabados
*/
public final class Module_List {
public static ArrayList<TTCN_Module> modules = new ArrayList<TTCN_Module>();
public static final ArrayList<TTCN_Module> modules = new ArrayList<TTCN_Module>();
private Module_List() {
// private constructor to disable accidental instantiation
......
......@@ -472,7 +472,7 @@ public final class TTCN_Logger {
Severity.DEBUG_UNQUALIFIED,
};
public static String severity_category_names[]={
public static final String severity_category_names[]={
"NULL",
"ACTION",
"DEFAULTOP",
......@@ -493,7 +493,7 @@ public final class TTCN_Logger {
/** Sub-category names for all Severity enum values,
* used when TTCN_Logger.log_event_types is set to log sub-categories */
public static String severity_subcategory_names[] = {
public static final String severity_subcategory_names[] = {
"",
// ACTION:
"UNQUALIFIED",
......
......@@ -51,7 +51,7 @@ public final class TTCN_Snapshot {
}
};
public static ThreadLocal<HashMap<SelectableChannel, Channel_Event_Handler>> channelMap = new ThreadLocal<HashMap<SelectableChannel, Channel_Event_Handler>>() {
public static final ThreadLocal<HashMap<SelectableChannel, Channel_Event_Handler>> channelMap = new ThreadLocal<HashMap<SelectableChannel, Channel_Event_Handler>>() {
@Override
protected HashMap<SelectableChannel, Channel_Event_Handler> initialValue() {
return new HashMap<SelectableChannel, Channel_Event_Handler>();
......
......@@ -40,7 +40,7 @@ public class TitanComponent extends Base_Type {
//Pseudo-component for logging when the MTC is executing a controlpart
public static final int CONTROL_COMPREF = -4;
public static ThreadLocal<TitanComponent> self = new ThreadLocal<TitanComponent>() {
public static final ThreadLocal<TitanComponent> self = new ThreadLocal<TitanComponent>() {
@Override
protected TitanComponent initialValue() {
return new TitanComponent();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment