How Does IDEA Generate Such Good Variable Names?

I was investigating a test generation project and I found that it generated terrible variable names (var0, var1 etc)
https://github.com/mernst/randoop/issues/51

How does IDEA generate such useful variable names?
Is there a chunk of code that I can copy and paste to do the same in the other project?

0
1 comment

You may look at com.intellij.psi.codeStyle.JavaCodeStyleManager#suggestVariableName(com.intellij.psi.codeStyle.VariableKind, java.lang.String, com.intellij.psi.PsiExpression, com.intellij.psi.PsiType, boolean) It uses everything IDEA knows about kind of variables, expressions, types, etc so it probably not so easy to repeat ouside of IDEA

Anna

0

Please sign in to leave a comment.