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
CompareTo Method generation also includes variables which are not comparable #15
Comments
for given example the output would be: public class SampleBean implements Comparable<SampleBean> {
private int testInt;
private String testString;
private Object testObject;
@Override
public int compareTo(SampleBean that) {
return ComparisonChain.start().compare(this.testInt, that.testInt)
.compare(this.testString, that.testString)
// XXX field 'testObject' java.lang.Object is not comparable
//.compare(this.testObject, that.testObject)
.result();
}
} |
a more complex example public class CompareTest implements Comparable<CompareTest> {
private String[] arraySample1;
private ClassWithComparable compEnabled;
private ClassWithoutComparable compDisabled;
private int intValue3;
private SampleEnum enumValue1;
private String simpleString1;
private InterfaceWithComparable iFaceWithComp;
private InterfaceWithoutComparable iFaceWithoutComp;
private ClassExtendsSomeComparable compEnabled2;
private ClassExtendSomeNonComparable compDisabled2;
private AbstractClassWithComparable compEnabled3;
private AbstractClassWithoutComparable compDisabled3;
@Override
public int compareTo(CompareTest that) {
return ComparisonChain.start()
// XXX field 'arraySample1' is an Array! and they are not comparable by default
//.compare(this.arraySample1, that.arraySample1)
.compare(this.compEnabled, that.compEnabled)
// XXX field 'compDisabled' does not implements java.lang.Comparable
//.compare(this.compDisabled, that.compDisabled)
.compare(this.intValue3, that.intValue3)
.compare(this.enumValue1, that.enumValue1)
.compare(this.simpleString1, that.simpleString1)
.compare(this.iFaceWithComp, that.iFaceWithComp)
// XXX field 'iFaceWithoutComp' does not implements java.lang.Comparable
//.compare(this.iFaceWithoutComp, that.iFaceWithoutComp)
.compare(this.compEnabled2, that.compEnabled2)
// XXX field 'compDisabled2' does not implements java.lang.Comparable
//.compare(this.compDisabled2, that.compDisabled2)
.compare(this.compEnabled3, that.compEnabled3)
// XXX field 'compDisabled3' does not implements java.lang.Comparable
//.compare(this.compDisabled3, that.compDisabled3)
.result();
}
} |
fixed with latest snapshot 1.4.0.201507091317 i will prepare a full release |
arolfes
added a commit
that referenced
this issue
Jul 14, 2015
arolfes
added a commit
that referenced
this issue
Jul 14, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
if you a variable which does not implement the comparable interface generated code does not compile.
Example
The text was updated successfully, but these errors were encountered: