public void platformChanged() {
   if (inPlatformChanged) {
     return;
   }
   inPlatformChanged = true;
   try {
     JavacardPlatform platform = activePlatform;
     if (platform != null) {
       SpecificationVersion version = platform.getSpecification().getVersion();
       if (selectedSourceLevel != null
           && selectedSourceLevel.compareTo(version) > 0
           && !shouldChangePlatform(selectedSourceLevel, version)) {
         props.setPlatformName(platform.getSystemName());
         // restore original
         return;
       } else {
         originalSourceLevel = null;
       }
     }
     activePlatform = props.getPlatform();
     resetCache();
   } finally {
     inPlatformChanged = false;
   }
 }