Menu

#2 Bug in Field generation in JavaSource

v1.0_(example)
open
nobody
Arch4J (1)
5
2004-05-04
2004-05-04
No

In v1.1 of Arch4J there is a bug in
JavaSourceFile.generateFields().

It will only add the fields if the JavaObject is a class,
however a Java Interface can have final fields (like your
JavaKeywordConstants interface has).

The code as it stands does not permit this.

That method might be updated to look like this instead:

for (int i = 0; i < fields.size(); i++) {

JavaFieldDefinition thisField = (JavaFieldDefinition)
fields.get(i);

if( objectDefinition.isClassDefinition() ||
(objectDefinition.isInterfaceDefinition() &&
thisField.isFinal() ) )
{
if (i > 0) {
buffer.appendBlankLine();
}
thisField.writeDefinitionTo(buffer);
}
}

Discussion


Log in to post a comment.