Use this page to discuss script 490 java_getset: automatically add getter/setters for Java properties
- Add constructive comments, bug reports, or discuss improvements (see the guideline).
- Do not document the script here (the author should do that on vim.org).
- This page may be out of date: check the script's vim.org page above, and its release notes.
Problem with generics
Superb script really great, however it seems to fail on generics.
private List<String> foo;
getset won't generate methods for this field.
private List foo;
but it will when generics are removed. --January 16, 2012
- A quick hack to support generics:
- Open your
java_getset.vim
file - Search for definition of
s:variable
(i.e.let s:variable = ......
) - Before that line add a new definition:
let s:generics = '\%(\s*\%(<.*>\)\)\='
- Change the definition of
s:variable
to (see underlined part):let s:variable = '\(\s*\)\(\(' . s:modifier . '\s\+\)*\)\(' . s:javaname . s:generics . '\)' . s:brackets . '\s\+\(' . s:javaname . '\)\s*\(;\|=[^;]\+;\)'
- Open your
- What this does is it extends the regular expression matching the field definitions by adding "
<...>
" to the type part. Actually it does not check for what's inside the angle brackets and since allowing for multi-type generics and nested generics, too. - (As with the nature of quick hacks this one does not fix the javadoc creation where angle brackets will still appear as angle brackets instead of HTML-code.)
- --February 27, 2012
Comments
Unrelated, but I love the comments in this script! Great job commenting your code!!! Very organized and easy to follow!!