Details
-
Improvement
-
Status: Resolved
-
Major
-
Resolution: Complete
-
1.2.3.RELEASE
-
None
Description
In ROO-635 is reported that parse library has problems with comments and JavaDoc but I found than Roo takes part in this bug.
The problems is that TypeManagementServiceImpl.createOrUpdateTypeOnDisk always creates a new file based on Roo Compilation-unit metadata. So, as Roo metadata has no support to comments nor javaDoc in metadata, the new .java file will have none.
TypeManagementServiceImpl.java
public void createOrUpdateTypeOnDisk(final ClassOrInterfaceTypeDetails cid) { final String fileCanonicalPath = typeLocationService .getPhysicalTypeCanonicalPath(cid.getDeclaredByMetadataId()); final String newContents = typeParsingService .getCompilationUnitContents(cid); fileManager.createOrUpdateTextFileIfRequired(fileCanonicalPath, newContents, true); }
To solve this problem we propose this:
- Modify TypeManagementServiceImpl.createOrUpdateTypeOnDisk to check if .java file exists:
- If no exists call to getCompilationUnitContents to generate new .java contents (CREATE).
- If exists call to a new TypeParsingService method which generates .java contents based on original compilation-unit updated with ClassOrInterfaceTypeDetails information (UPDATE).
- New method:
- Modify TypeParsingService to declare a new method String updateAndGetCompilationUnitContents(String fileIdentifier, ClassOrInterfaceTypeDetails cid). This must do:
- Parse fileIdentifier to load original compilation-unit information.
- Update compilation-unit with information contained in cid.
- Returns a String with contents of new compilation-unit.
- Implements JavaParserTypeParsingService.updateAndGetCompilationUnitContents
- Modify TypeParsingService to declare a new method String updateAndGetCompilationUnitContents(String fileIdentifier, ClassOrInterfaceTypeDetails cid). This must do: