Skip to content

Commit

Permalink
改进代码使之兼容java 8
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Zhou committed Nov 28, 2013
1 parent 8ec590c commit 16a9f7a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
import com.alibaba.citrus.springext.Schema;
import com.alibaba.citrus.springext.Schema.Transformer;
import com.alibaba.citrus.springext.Schemas;
import com.alibaba.citrus.springext.support.SpringExtSchemaSet;
import com.alibaba.citrus.springext.support.SchemaSet;
import com.alibaba.citrus.springext.support.SpringExtSchemaSet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -245,36 +245,36 @@ public String toString() {
}
}

private final class Entries extends HashMap<String, Entry> {
private final class Entries extends HashMap<String, SchemaExporter.Entry> {
private static final long serialVersionUID = -4000525580274040823L;

public Entries() {
super.put("", new Entry());
super.put("", new SchemaExporter.Entry());
}

public Entry getRoot() {
public SchemaExporter.Entry getRoot() {
return get("");
}

@Override
public Entry put(String path, Entry entry) {
public SchemaExporter.Entry put(String path, SchemaExporter.Entry entry) {
assertTrue(path.equals(entry.getPath()));

if (path.endsWith("/")) {
path = path.substring(0, path.length() - 1);
}

String parentPath = path.substring(0, path.lastIndexOf("/") + 1);
Entry parentEntry = get(parentPath);
SchemaExporter.Entry parentEntry = get(parentPath);

if (parentEntry == null) {
parentEntry = new Entry(parentPath);
parentEntry = new SchemaExporter.Entry(parentPath);
this.put(parentPath, parentEntry); // recursively
}

parentEntry.subEntries.put(entry.getSortKey(), entry);

Entry old = super.put(entry.getPath(), entry);
SchemaExporter.Entry old = super.put(entry.getPath(), entry);

log.trace("Added entry: {}", entry.getPath());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,15 +154,7 @@ public void createHashMap_noArgs() {
@Test
public void createHashMap_capacity() {
Map<String, Integer> map = createHashMap(2);
assertTrue(map instanceof HashMap<?, ?>);

map.put("a", 1);
map.put("b", 1);
map.put("c", 1);
map.put("d", 1);
map.put("e", 1);

assertArrayNotEquals(new Object[] { "a", "b", "c", "d", "e" }, map.keySet().toArray());
assertSame(HashMap.class, map.getClass());
}

@Test
Expand Down
21 changes: 12 additions & 9 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -723,44 +723,47 @@
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.6</version>
<version>1.7</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<!-- 较低版本有bug,导致hessian不能编译通过。 -->
<version>2.3.2</version>
<version>3.1</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.2</version>
<version>2.4</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.7</version>
<version>2.8.1</version>
<configuration>
<!-- 默认不发布 -->
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.8</version>
<version>2.9</version>
</plugin>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
<version>1.4</version>
<version>2.2</version>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>2.1.2</version>
<version>2.2.1</version>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.8</version>
<version>2.9.1</version>
<configuration>
<additionalparam>-Xdoclint:none</additionalparam>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.10</version>
<version>2.16</version>
</plugin>
<plugin>
<groupId>org.eclipse.jetty</groupId>
Expand Down

0 comments on commit 16a9f7a

Please sign in to comment.