Skip to content

Commit

Permalink
WELD-1794 Probe - additional bean archives should have the lowest
Browse files Browse the repository at this point in the history
priority when sorting
  • Loading branch information
mkouba authored and jharting committed Jan 22, 2015
1 parent 5787844 commit 1b99ac5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package org.jboss.weld.probe;

import static org.jboss.weld.probe.Strings.ACCESSIBLE_BDAS;
import static org.jboss.weld.probe.Strings.ADDITIONAL_BDA_SUFFIX;
import static org.jboss.weld.probe.Strings.ALTERNATIVES;
import static org.jboss.weld.probe.Strings.ANNOTATED_METHOD;
import static org.jboss.weld.probe.Strings.AS_STRING;
Expand Down Expand Up @@ -120,8 +121,11 @@ final class JsonObjects {

private static final Comparator<BeanDeploymentArchive> bdaComparator = new Comparator<BeanDeploymentArchive>() {
@Override
public int compare(BeanDeploymentArchive o1, BeanDeploymentArchive o2) {
return o1.getId().compareTo(o2.getId());
public int compare(BeanDeploymentArchive bda1, BeanDeploymentArchive bda2) {
// Additional bean archive should have the lowest priority when sorting
// This suffix is supported by WildFly and Weld Servlet
int result = Boolean.compare(bda1.getId().endsWith(ADDITIONAL_BDA_SUFFIX), bda2.getId().endsWith(ADDITIONAL_BDA_SUFFIX));
return result == 0 ? bda1.getId().compareTo(bda2.getId()) : result;
}
};

Expand Down
2 changes: 2 additions & 0 deletions probe/core/src/main/java/org/jboss/weld/probe/Strings.java
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ final class Strings {
static final String RESOURCE_PARAM_START = "{";
static final String RESOURCE_PARAM_END = "}";

static final String ADDITIONAL_BDA_SUFFIX = ".additionalClasses";

private Strings() {
}

Expand Down

0 comments on commit 1b99ac5

Please sign in to comment.