[jbosstools-issues] [JBoss JIRA] (JBIDE-22283) reveng *.java emitter does not escape java keyword 'return' as variable name

Koen Aers (JIRA) issues at jboss.org
Thu Jul 28 11:29:00 EDT 2016


    [ https://issues.jboss.org/browse/JBIDE-22283?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13272236#comment-13272236 ] 

Koen Aers commented on JBIDE-22283:
-----------------------------------

I have fixed the issue in the hibernate tools runtime (versions 4.3.5.Final, 5.0.1.Final, 5.1.0.Beta2 and 5.2.0.Alpha3) and included these runtimes in the respective JBoss Tools plugins. I did not incorporate fancy heuristics like getting the first possible non-clashing available name as suggested above by [~dlmiles] as that would need a big refactoring (the properties and accessor methods are generated in different templates, do a lot more bookkeeping would be needed). I also don't think that there is a good use case of having multiple columns mapping to properties with the same name. I used the simple heuristic of adding an underscore after the name just like the default reveng strategy does with table and column names that are reserved words. If something more sophisticated is really needed, please open a different issue. 

> reveng *.java emitter does not escape java keyword 'return' as variable name
> ----------------------------------------------------------------------------
>
>                 Key: JBIDE-22283
>                 URL: https://issues.jboss.org/browse/JBIDE-22283
>             Project: Tools (JBoss Tools)
>          Issue Type: Bug
>          Components: hibernate
>    Affects Versions: 4.3.x
>         Environment: Eclipse Mars
>            Reporter: Darryl Miles
>            Assignee: Koen Aers
>             Fix For: 4.4.1.AM3
>
>
> reveng *.java emitter does not escape java keyword 'return' as variable name
> 	<table name="oc_return_history">
> 		<foreign-key constraint-name="FK_oc_return_history__return_id" foreign-table="oc_return">
> 			<column-ref local-column="return_id" foreign-column="return_id"/>
> 			<!-- this breaks the generator trying to name local variable as a java keyword -->
> 			<many-to-one property="return"/>
> 		</foreign-key>
> 	</table>
> The expected output would be:
> private Return _return;
> but actual output is:
> private Return return;



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)


More information about the jbosstools-issues mailing list