Actual fix for #1660

Set the warning type id correctly or not at all. But in any case do not
set the type id = thread id.
Removal of no longer needed method
Merge pull request #1677 from Evenprime/feature

Actual fix for #1660