#1094 incorrect formal charge comparison in CDKAtomTypeMatcher

closed
5
2012-10-08
2010-09-07
Egon Willighagen
No

atom.getFormalCharge() != type.getFormalCharge()

this works under some conditions as can be seen from the below code which outputs false, true, true (thanx to Jonathan for the code, [0]):

1 public class Test {
2
3 public static void main(String[] _) {
4 Integer i = new Integer(0);
5 Integer j = new Integer(0);
6 System.out.println(i==j);
7 i = 0;
8 j = 0;
9 System.out.println(i==j);
10 i = Integer.valueOf(0);
11 j = Integer.valueOf(0);
12 System.out.println(i==j);
13 j = Integer.valueOf(0);
14 i = 0;
15 System.out.println(i==j);
16 }
17 }

I believe this problem applies to both CDK 1.2.x as well as master.

  1. http://gist.github.com/568516

Discussion

  • Patch has been applied.