Exploiting Agents and Ontologies for Type- and Meaning-Safe Adaptation of Java Programs