Vineet Reynolds created FORGE-1097:
--------------------------------------
Summary: Forge Java parser fails to distinguish between several fields in a
FieldDeclaration
Key: FORGE-1097
URL:
https://issues.jboss.org/browse/FORGE-1097
Project: Forge
Issue Type: Bug
Components: Parsers / File Manipulation
Affects Versions: 1.3.3.Final
Reporter: Vineet Reynolds
Priority: Critical
Consider the following test:
{code:java}
@Test
public void testFieldTypesByteExtraDimensionDeclarationTest()
{
final JavaClass javaClass = JavaParser.create(JavaClass.class);
final Field<JavaClass> field = javaClass.addField("public byte
content1[], content2;");
Assert.assertEquals("content1", field.getName());
Assert.assertEquals("byte[]", field.getQualifiedType());
Assert.assertEquals("byte[]", field.getType());
Assert.assertTrue(field.getTypeInspector().isArray());
}
{code}
The above shown behavior is obviously incorrect since the second 'field' named
content2 is 'lost' and so is information about it's type.
The underlying issue is that of the parser treating the FieldDeclaration as that belonging
to a single field, whereas there may be several VariableDeclarationFragments within the
same FieldDeclaration. Ideally, this should be solved by introducing a new type like
{{Variable}} to identify individual variables in the declaration, or to change the
semantic of {{Field}} to refer to the individual variables.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:
http://www.atlassian.com/software/jira