@@ -73,9 +73,9 @@ public AutoCompletionResult autocomplete(final String code, final int index,
7373 else if (code .contains ("." )) {
7474 final List <String > codeList = Arrays .asList (code .split ("\\ ." ));
7575 final String objectString = codeList .get (codeList .size () - 2 );
76- final String fieldBeginWith = codeList .get (codeList .size () - 1 );
76+ final String prefix = codeList .get (codeList .size () - 1 );
7777 matches .addAll (engineAttributesCompleter (objectString + "." ,
78- fieldBeginWith , index , engine ));
78+ prefix , index , engine ));
7979
8080 }
8181 else {
@@ -124,10 +124,11 @@ private List<String> engineAttributesCompleter(final String objectString,
124124 }
125125
126126 private List <String > engineAttributesCompleter (final String objectString ,
127- final String fieldBeginWith , @ SuppressWarnings ("unused" ) final int index ,
127+ final String prefix , @ SuppressWarnings ("unused" ) final int index ,
128128 final ScriptEngine engine )
129129 {
130130 final List <String > matches = new ArrayList <>();
131+ final String lPrefix = prefix .toLowerCase ();
131132
132133 final Bindings bindings = engine .getBindings (ScriptContext .ENGINE_SCOPE );
133134
@@ -136,9 +137,7 @@ private List<String> engineAttributesCompleter(final String objectString,
136137 final Object obj = bindings .get (key );
137138 // check for public field completions
138139 for (final Field field : obj .getClass ().getFields ()) {
139- if (field .getName ().toLowerCase ().startsWith (fieldBeginWith
140- .toLowerCase ()))
141- {
140+ if (field .getName ().toLowerCase ().startsWith (lPrefix )) {
142141 matches .add (objectString + field .getName ());
143142 }
144143 }
0 commit comments