Skip to content

#154. Fixed the issue causing scala to break #155

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 21, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public <T> T instantiateExactlyOneSubclass(Class<T> parentType, String packagePa
public <T> Collection<? extends T> instantiateSubclasses(Class<T> parentType, String packagePath, Class[] constructorParams, Object[] constructorArgs) {
Collection<T> result = new HashSet<T>();
for (Class<? extends T> clazz : getDescendants(parentType, packagePath)) {
if (Utils.isInstantiable(clazz)) {
if (Utils.isInstantiable(clazz) && Utils.hasConstructor(clazz, constructorParams)) {
result.add(newInstance(constructorParams, constructorArgs, clazz));
}
}
Expand Down
9 changes: 9 additions & 0 deletions core/src/main/java/cucumber/runtime/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@ public static <T> List<T> listOf(int size, T obj) {
public static boolean isInstantiable(Class<?> clazz) {
return Modifier.isPublic(clazz.getModifiers()) && !Modifier.isAbstract(clazz.getModifiers());
}

public static boolean hasConstructor(Class<?> clazz, Class[] paramTypes) {
try {
clazz.getConstructor(paramTypes);
return true;
} catch (NoSuchMethodException e) {
return false;
}
}

public static String packagePath(Class clazz) {
return packagePath(packageName(clazz.getName()));
Expand Down
5 changes: 2 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,11 @@
<artifactId>cucumber-picocontainer</artifactId>
<version>${project.version}</version>
</dependency>
<!-- Not cooking scala, should not include it in the depends
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-scala</artifactId>
<version>${project.version}</version>
</dependency> -->
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>gherkin</artifactId>
Expand Down Expand Up @@ -254,8 +253,8 @@
<module>rhino</module>
<module>java</module>
<module>clojure</module>
<module>scala</module>

<!--<module>scala</module>-->
<!--<module>openejb</module>-->
</modules>

Expand Down
2 changes: 1 addition & 1 deletion scala/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<groupId>info.cukes</groupId>
<artifactId>cucumber-jvm</artifactId>
<relativePath>../pom.xml</relativePath>
<version>1.0.0.RC7-SNAPSHOT</version>
<version>1.0.0.RC11-SNAPSHOT</version>
</parent>

<artifactId>cucumber-scala</artifactId>
Expand Down