2121
2222import java .io .IOException ;
2323import java .nio .charset .Charset ;
24+ import java .util .Collections ;
2425import java .util .HashMap ;
2526import java .util .HashSet ;
2627import java .util .Locale ;
3536import org .sonarsource .scanner .lib .internal .cache .Logger ;
3637
3738/**
38- * Entry point to run SonarQube analysis programmatically.
39+ * Entry point to run a Sonar analysis programmatically.
3940 *
4041 * @since 2.2
4142 */
@@ -48,15 +49,12 @@ public class EmbeddedScanner {
4849 private final LogOutput logOutput ;
4950 private final Map <String , String > globalProperties = new HashMap <>();
5051 private final Logger logger ;
51- private final Set <String > classloaderMask = new HashSet <>();
52- private final Set <String > classloaderUnmask = new HashSet <>();
5352 private final System2 system ;
5453
5554 EmbeddedScanner (IsolatedLauncherFactory bl , Logger logger , LogOutput logOutput , System2 system ) {
5655 this .logger = logger ;
5756 this .launcherFactory = bl ;
5857 this .logOutput = logOutput ;
59- this .classloaderUnmask .add ("org.sonarsource.scanner.lib.internal.batch." );
6058 this .system = system ;
6159 }
6260
@@ -75,28 +73,16 @@ public Map<String, String> globalProperties() {
7573 return globalProperties ;
7674 }
7775
78- public EmbeddedScanner unmask (String fqcnPrefix ) {
79- checkLauncherDoesntExist ();
80- classloaderUnmask .add (fqcnPrefix );
81- return this ;
82- }
83-
84- public EmbeddedScanner mask (String fqcnPrefix ) {
85- checkLauncherDoesntExist ();
86- classloaderMask .add (fqcnPrefix );
87- return this ;
88- }
89-
9076 /**
91- * Declare SonarQube properties needed to download the scanner-engine from the server (sonar.host.url, credentials, proxy, ...).
77+ * Declare technical properties needed to bootstrap (sonar.host.url, credentials, proxy, ...).
9278 */
9379 public EmbeddedScanner addGlobalProperties (Map <String , String > p ) {
9480 globalProperties .putAll (p );
9581 return this ;
9682 }
9783
9884 /**
99- * Declare a SonarQube property needed to download the scanner-engine from the server (sonar.host.url, credentials, proxy, ...).
85+ * Declare a technical property needed to bootstrap (sonar.host.url, credentials, proxy, ...).
10086 */
10187 public EmbeddedScanner setGlobalProperty (String key , String value ) {
10288 globalProperties .put (key , value );
@@ -181,7 +167,9 @@ private void setGlobalDefaultValue(String key, String value) {
181167
182168 protected void doStart () {
183169 checkLauncherDoesntExist ();
184- ClassloadRules rules = new ClassloadRules (classloaderMask , classloaderUnmask );
170+ Set <String > unmaskRules = new HashSet <>();
171+ unmaskRules .add ("org.sonarsource.scanner.lib.internal.batch." );
172+ ClassloadRules rules = new ClassloadRules (Collections .emptySet (), unmaskRules );
185173 launcher = launcherFactory .createLauncher (globalProperties (), rules );
186174 }
187175
0 commit comments