Permalink
Browse files

Using new Utils.isInstantiable

  • Loading branch information...
1 parent 3e970a5 commit b446c0b4b3fcfad6ea0c231597ea6ec1a967d3c4 @vasiliygagin committed Feb 2, 2012
Showing with 1 addition and 5 deletions.
  1. +1 −5 java/src/main/java/cucumber/runtime/java/ClasspathMethodScanner.java
@@ -25,12 +25,8 @@ public void scan(JavaBackend javaBackend, List<String> gluePaths) {
for (String gluePath : gluePaths) {
String packageName = gluePath.replace('/', '.').replace('\\', '.'); // Sometimes the gluePath will be a path, not a package
for (Class<?> candidateClass : resourceLoader.getDescendants(Object.class, packageName)) {
- while (candidateClass != Object.class) {
+ while (candidateClass != Object.class && !Utils.isInstantiable(candidateClass)) {
// those can't be instantiated without container class present.
- boolean nonStaticInnerClass = candidateClass.getEnclosingClass() != null && !Modifier.isStatic(candidateClass.getModifiers());
- if (!nonStaticInnerClass && Utils.isInstantiable(candidateClass)) {
- break;
- }
candidateClass = candidateClass.getSuperclass();
}
for (Method method : candidateClass.getMethods()) {

0 comments on commit b446c0b

Please sign in to comment.