mbien commented on code in PR #8797:
URL: https://github.com/apache/netbeans/pull/8797#discussion_r2328883388


##########
extide/gradle/netbeans-gradle-tooling/src/main/java/org/netbeans/modules/gradle/tooling/NbProjectInfoBuilder.java:
##########
@@ -1562,6 +1563,23 @@ private void detectDependencies(NbProjectInfoModel 
model) {
         boolean ignoreUnresolvable = 
(project.getPlugins().hasPlugin("java-platform") &&
             Boolean.TRUE.equals(getProperty(project, "javaPlatform", 
"allowDependencies")));
 
+        // https://github.com/apache/netbeans/issues/8764
+        Function<ProjectDependency, Project> projDependencyToProject =
+            sinceGradleOrDefault(
+                "9.0",
+                () -> {
+                    Method getPath = 
ProjectDependency.class.getMethod("getPath");
+                    return dep -> {
+                        try {
+                            String path = (String) getPath.invoke(dep);
+                            return project.findProject(path);
+                        } catch (ReflectiveOperationException e) {
+                            throw new UnsupportedOperationException(e);
+                        }
+                    };
+                },
+                () -> ProjectDependency::getDependencyProject); // removed in 
Gradle 9

Review Comment:
   IMO: this would be more future proof if we would call the new method 
directly and use reflection for the removed method. (basically the other way 
around)
   
   @lkishalmi @sdedic do you think we can bump the gradle tooling version of 
this module so that we can call `getPath()` directly?



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to