Skip to content

Commit

Permalink
Groovy REPL: constructor tab completion failed: NoClassDefFoundError, f…
Browse files Browse the repository at this point in the history
…ixes #568
  • Loading branch information
mattirn committed Sep 10, 2020
1 parent 6158378 commit db15475
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions groovy/src/main/java/org/jline/script/GroovyEngine.java
Original file line number Diff line number Diff line change
Expand Up @@ -766,24 +766,34 @@ private void doStaticMethodCandidates(List<Candidate> candidates, Class<?> clazz

private Set<String> retrieveConstructors() {
Set<String> out = new HashSet<>();
for (Map.Entry<String, Class<?>> entry : inspector.nameClass().entrySet()) {
for (Iterator<Map.Entry<String, Class<?>>> it = inspector.nameClass().entrySet().iterator(); it.hasNext(); ) {
Map.Entry<String, Class<?>> entry = it.next();
Class<?> c = entry.getValue();
if (c.getConstructors().length == 0 || Modifier.isAbstract(c.getModifiers())) {
continue;
try {
if (c.getConstructors().length == 0 || Modifier.isAbstract(c.getModifiers())) {
continue;
}
out.add(entry.getKey());
} catch (NoClassDefFoundError e) {
it.remove();
}
out.add(entry.getKey());
}
return out;
}

private Set<String> retrieveClassesWithStaticMethods() {
Set<String> out = new HashSet<>();
for (Map.Entry<String, Class<?>> entry : inspector.nameClass().entrySet()) {
for (Iterator<Map.Entry<String, Class<?>>> it = inspector.nameClass().entrySet().iterator(); it.hasNext(); ) {
Map.Entry<String, Class<?>> entry = it.next();
Class<?> c = entry.getValue();
if (Helpers.getStaticMethods(c).size() == 0 && Helpers.getStaticFields(c).size() == 0) {
continue;
try {
if (Helpers.getStaticMethods(c).size() == 0 && Helpers.getStaticFields(c).size() == 0) {
continue;
}
out.add(entry.getKey());
} catch (NoClassDefFoundError e) {
it.remove();
}
out.add(entry.getKey());
}
return out;
}
Expand Down

0 comments on commit db15475

Please sign in to comment.