To be exact, symlink is in the directory ~/a, and it points to ~/test and there is also a directory ~/.java. So, after cd ~/a/symlink, there are two ../.java files -- one in the physical parent, and one in the logical parent. The former is a directory, the latter is a plain file.
~/a/symlink$ cd ../ produces one alternative: .java, but only if the plain file .java exists. So, it seems that filenames of all ~/ directories seem to be matched against filenames of all ~/a/ files of any kind, and the AND result is used by the completion. But, if there is some directory in the logical directory, that does not have its namesake in the physical directory, it is ignored: ls -la ~/a total 16 drwxr-xr-x 4 art art 4096 Apr 23 09:51 . drwxr-xr-x 83 art art 4096 Apr 23 09:51 .. drwxr-xr-x 2 art art 4096 Apr 19 14:48 .hidden drwxr-xr-x 2 art art 4096 Apr 23 09:51 i -rw-r--r-- 1 art art 0 Apr 23 09:40 .java lrwxrwxrwx 1 art art 7 Apr 19 14:48 symlink -> ../test ~/a/symlink$ cd ../i [completion shows only .java, but cd works for i as well] ~/a/i$ To sum that up, files in the logical directory sometimes affect the cd completion even that they are not directories at all, and sometimes they are ignored even that they are directories indeed.