]
George Gastaldi updated FORGE-935:
----------------------------------
Fix Version/s: 2.0.0.Alpha5
(was: 1.x Future)
ResourceFactory incorrectly handles specific resources
------------------------------------------------------
Key: FORGE-935
URL:
https://issues.jboss.org/browse/FORGE-935
Project: Forge
Issue Type: Bug
Components: Resources API
Affects Versions: 2.0.0.Alpha4
Reporter: George Gastaldi
Assignee: George Gastaldi
Priority: Critical
Fix For: 2.0.0.Alpha5
When ResourceFactory.create(Object) is called and the argument is a File pointing to a
*.java file, I expect a JavaResource object to be returned, however, a FileResource is
returned instead.
It appears that the algorithm is not deterministic, since I've seen it return
JavaResource sometimes.
The following failling test illustrates it:
{code}
@Test
public void testJavaResourceCreationSpecialized() throws Exception
{
JavaClass javaClass =
JavaParser.create(JavaClass.class).setPackage("org.jboss.forge.test").setName("Example");
JavaResource resource = factory.create(JavaResource.class,
File.createTempFile("forge", ".java"));
resource.createNewFile();
resource.setContents(javaClass);
Resource<File> newResource =
factory.create(resource.getUnderlyingResourceObject());
Assert.assertThat(newResource, is(instanceOf(JavaResource.class)));
}
{code}
--
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: