gnodet-bot commented on code in PR #13625:
URL: https://github.com/apache/maven/pull/13625#discussion_r4315574096


##########
api/maven-api-core/src/main/java/org/apache/maven/api/PluginRealm.java:
##########
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api;
+
+import java.util.Optional;
+
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Nonnull;
+import org.apache.maven.api.services.Lookup;
+
+/**
+ * Represents the runtime scope of a Maven plugin.
+ *
+ * @since 4.1.0
+ */
+@Experimental
+public interface PluginRealm {
+
+    /**
+     * Returns the classloader for this realm.
+     *
+     * @return the classloader, never {@code null}
+     */
+    @Nonnull
+    ClassLoader classLoader();
+
+    /**
+     * Returns the JPMS module layer when this plugin runs as a modular plugin.
+     *
+     * @return the module layer, or an empty optional for a classpath-based 
realm
+     */
+    @Nonnull
+    Optional<ModuleLayer> moduleLayer();
+
+    /**
+     * Returns component lookup scoped to this realm's visibility.
+     *
+     * @return the realm-scoped component lookup, never {@code null}

Review Comment:
   💡 The Javadoc says "Returns component lookup scoped to this realm's 
visibility" — but `DefaultPluginRealm.RealmLookup.scoped()` only swaps the 
Thread Context Class Loader (TCCL). No ClassWorlds realm-scoped visibility 
isolation occurs. The wording overstates the contract.
   
   ```suggestion
        * Returns component lookup with this realm's class loader set as the 
Thread Context Class Loader.
        *
        * @return the lookup with TCCL bound to this realm's class loader, 
never {@code null}
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to