Make sure that method signature for Integer getModelIndex() is exactly the same, otherwise the class file may include two method signature for exactly the same method, and differences with annotations in the output class files in the Eclipse and Oracle javac can lead to unexpected bugs and changes in behavior from development to deployment. Scary!

This commit is contained in:
Reinhard Pointner 2017-01-08 00:11:58 +08:00
parent 9347f36b0a
commit 8606ef44ca
3 changed files with 7 additions and 5 deletions

View File

@ -30,8 +30,9 @@ public class ExpressionBindings extends AbstractMap<String, Object> implements B
for (String name : define.value()) {
Method existingBinding = bindings.put(name, method);
if (existingBinding != null)
if (existingBinding != null) {
throw new IllegalArgumentException(String.format("Illegal binding {%s} on %s", name, method.getName()));
}
}
}
}

View File

@ -953,18 +953,18 @@ public class MediaBindingBean {
}
@Define("i")
public Number getModelIndex() {
public Integer getModelIndex() {
return 1 + identityIndexOf(context.values(), getInfoObject());
}
@Define("di")
public Number getDuplicateIndex() {
public Integer getDuplicateIndex() {
return 1 + identityIndexOf(context.values().stream().filter(getInfoObject()::equals).collect(toList()), getInfoObject());
}
@Define("dc")
public Number getDuplicateCount() {
return context.values().stream().filter(getInfoObject()::equals).count();
public Integer getDuplicateCount() {
return context.values().stream().filter(getInfoObject()::equals).mapToInt(i -> 1).sum();
}
@Define("plex")

View File

@ -24,6 +24,7 @@ public class IndexedBindingBean extends MediaBindingBean {
this.to = to;
}
@Override
@Define("i")
public Integer getModelIndex() {
return i;