Problem with getter template for boolean - blank in method name

I have a problem generating getters for booleans.
Obviously there is a blank in the generation template. Unfortunately I have no clue how to fix this or
where to find the appropriate configuration (search for the template in all files without result).
The error popup:
intellij idea gettersetter prob.png

I have not changed any code generation prefix. Intellij Idea version is 14.1.5

By the way: https://www.jetbrains.com/idea/help/getter-and-setter-templates-dialog.html
-> I have no such "Getter / Setter Template" item in any of the code generation config tabs. Is this outdated?

Any clue anyone?

2 comments
Comment actions Permalink

There should be choosers on the top of list of available fields, please check the template there

Anna



Attachment(s):
Capture.PNG
0
Comment actions Permalink

Obviously the problem was our template:

/**
* @return the {@link #$field.name}
*/
public ##
#if($field.modifierStatic)

static ##
#end
$field.type ##
#set($name = $StringUtil.capitalizeWithJavaBeanConvention($StringUtil.sanitizeJavaIdentifier($helper.getPropertyName($field, $project))))

#if ($field.boolean && $field.primitive)
    #if ($StringUtil.startsWithIgnoreCase($name, 'is'))
        #set($name = $StringUtil.decapitalize($name))
    #else
    
is##
    #end
#else
get##
#end
${name}
() {
return $field.name;
}


I still don't know what's wrong with the above. However, I just copied the Intellij default and inserted the Javadoc above and this does the trick. Maybe there is a problem with tabs.

Thanks for your help, Anna. :)

0

Please sign in to leave a comment.