I am just starting to us Guava in place of Google-Collections. The Splitter class seemed cool. But when I use it, like this:
private static final Pattern p = Pattern.compile(" +");
private static final Splitter usSplitter = Splitter.on(p).trimResults();
I get a stack dump:
java.lang.NoSuchMethodError: com.google.common.base.Platform.precomputeCharMatcher(Lcom/google/common/base/CharMatcher;)Lcom/google/common/base/CharMatcher;
at com.google.common.base.CharMatcher.precomputed(CharMatcher.java:662)
at com.google.common.base.CharMatcher.<clinit>(CharMatcher.java:69)
at com.google.common.base.Splitter.<init>(Splitter.java:99)
at com.google.common.base.Splitter.on(Splitter.java:208)
The javadocs have nothing about this "com.google.common.base.Platform." so its a bit hard to guess what is going wrong.
As you can see, the Pattern is dead simple.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…