// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.openapi.projectRoots.impl;

import java.io.File;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;

class JavaHomeFinderWindows extends JavaHomeFinderBasic {
  JavaHomeFinderWindows(boolean forceEmbeddedJava) {
    super(forceEmbeddedJava);

    registerFinder(() -> {
      File[] fsRoots = File.listRoots();
      if (fsRoots == null) return Collections.emptySet();

      Set<File> roots = new HashSet<>();
      for (File root : fsRoots) {
        if (!root.exists()) continue;

        roots.add(new File(new File(root, "Program Files"), "Java"));
        roots.add(new File(new File(root, "Program Files (x86)"), "Java"));
        roots.add(new File(root, "Java"));
      }

      return scanAll(roots, true);
    });
  }
}

@@ -180,17 +180,16 @@
 ots.impl
-;
 %0A%0Aimport
@@ -201,17 +201,16 @@
 .io.File
-;
 %0Aimport 
@@ -223,70 +223,20 @@
 til.
-Collections;%0Aimport java.util.HashSet;%0Aimport java.util.Set;%0A%0A
+*%0A%0Ainternal 
 clas
@@ -263,15 +263,9 @@
 ows 
-extends
+:
  Jav
@@ -289,38 +289,20 @@
 %7B%0A  
-JavaHomeFinderWindows(boolean 
+constructor(
 forc
@@ -314,23 +314,28 @@
 ddedJava
-) %7B%0A   
+: Boolean) :
  super(f
@@ -351,18 +351,18 @@
 dedJava)
-;%0A
+ %7B
 %0A    reg
@@ -376,14 +376,8 @@
 nder
-(() -%3E
  %7B%0A 
@@ -385,14 +385,11 @@
     
-File%5B%5D
+val
  fsR
@@ -415,104 +415,96 @@
 ts()
-;%0A      if (fsRoots == null) return Collections.emptySet();%0A%0A      Set%3CFile%3E roots = new
+ ?: return@registerFinder emptySet%3CString%3E()%0A      val roots: MutableSet%3CFile%3E =
  HashSet
 %3C%3E()
@@ -503,13 +503,10 @@
 hSet
-%3C%3E
 ()
-;
 %0A   
@@ -517,19 +517,15 @@
 or (
-File 
 root 
-:
+in
  fsR
@@ -568,18 +568,16 @@
 continue
-;%0A
 %0A       
@@ -583,37 +583,29 @@
   roots.add(
-new 
 File(
-new 
 File(root, %22
@@ -621,33 +621,32 @@
 iles%22), %22Java%22))
-;
 %0A        roots.a
@@ -652,21 +652,13 @@
 add(
-new 
 File(
-new 
 File
@@ -692,25 +692,24 @@
 %22), %22Java%22))
-;
 %0A        roo
@@ -719,12 +719,8 @@
 add(
-new 
 File
@@ -734,17 +734,16 @@
 %22Java%22))
-;
 %0A      %7D
@@ -747,22 +747,14 @@
   %7D%0A
-%0A
       
-return 
 scan
@@ -773,17 +773,14 @@
 rue)
-;
 %0A    %7D
-);
 %0A  %7D

Convert class JavaHomeFinderWindows to Kotlin (convert the content)