@@ -100,7 +100,7 @@ private static String[] getCompletion(Method m, String filter, String[] template
100100 ins += ")" ;
101101 return new String [] {str , ins };
102102 }
103- private static < T extends Field > String [] getCompletion (T f , String filter , String [] templateArgs )
103+ private static String [] getCompletion (Field f , String filter , String [] templateArgs )
104104 {
105105 String str = f .getName ();
106106 if (!str .startsWith (filter ))
@@ -144,6 +144,41 @@ else if (pack.length() != 0)
144144 return clazz ;
145145 }
146146
147+ private static final int STATIC_BIT = 1 << 0 ;
148+ private static final int PRIVATE_BIT = 1 << 1 ;
149+ private static final int PROTECTED_BIT = 1 << 2 ;
150+ private static final int PUBLIC_BIT = 1 << 3 ;
151+
152+ private static <T > int getModifiers (T t )
153+ {
154+ int modifiers = 0 ;
155+ if (t instanceof Method )
156+ {
157+ Method m = (Method ) t ;
158+ modifiers = m .getModifiers ();
159+ }
160+ else if (t instanceof Field )
161+ {
162+ Field f = (Field ) t ;
163+ modifiers = f .getModifiers ();
164+ }
165+ else if (t instanceof Class )
166+ {
167+ Class c = (Class ) t ;
168+ modifiers = c .getModifiers ();
169+ }
170+ int returnvalue = 0 ;
171+ if (Modifier .isStatic (modifiers ))
172+ returnvalue |= STATIC_BIT ;
173+ if (Modifier .isPrivate (modifiers ))
174+ returnvalue |= PRIVATE_BIT ;
175+ if (Modifier .isProtected (modifiers ))
176+ returnvalue |= PROTECTED_BIT ;
177+ if (Modifier .isPublic (modifiers ))
178+ returnvalue |= PUBLIC_BIT ;
179+ return returnvalue ;
180+ }
181+
147182 private static <T > void dumpCompletions (T [] arr , String filter , String [] templateArgs )
148183 {
149184 for (T t : arr )
@@ -153,7 +188,7 @@ private static <T> void dumpCompletions(T[] arr, String filter, String[] templat
153188 {
154189 continue ;
155190 }
156- System .out .println (completion [0 ] + sep + completion [1 ]);
191+ System .out .println (completion [0 ] + sep + completion [1 ] + sep + getModifiers ( t ) );
157192 }
158193 }
159194
0 commit comments