wrprice commented on code in PR #8810:
URL: https://github.com/apache/netbeans/pull/8810#discussion_r2386193595
##########
extide/gradle/netbeans-gradle-tooling/src/main/java/org/netbeans/modules/gradle/tooling/NbProjectInfoBuilder.java:
##########
@@ -1362,18 +1370,24 @@ private void detectArtifacts(NbProjectInfoModel model) {
}
}
Map<String, Object> archives = new HashMap<>();
- beforeGradle("5.2", () -> {
- // The jar.getCassifier() and jar.getArchievePath() are deprecated
since 5.2
- // These methods got removed in 8.0
- project.getTasks().withType(Jar.class).forEach(jar -> {
- archives.put(jar.getClassifier(), jar.getArchivePath());
- });
- });
- sinceGradle("5.2", () -> {
- project.getTasks().withType(Jar.class).forEach(jar -> {
- archives.put(jar.getArchiveClassifier().get(),
jar.getDestinationDirectory().file(jar.getArchiveFileName().get()).get().getAsFile());
- });
- });
+ Consumer<Jar> jarToArchivesClassifierAndPath =
+ sinceGradleOrDefault(
+ "5.2",
+ () -> jar -> archives.put(jar.getArchiveClassifier().get(),
jar.getDestinationDirectory().file(jar.getArchiveFileName().get()).get().getAsFile()),
+ () -> {
+ // The jar.getCassifier() and jar.getArchievePath() are
deprecated since 5.2
+ // These methods got removed in 8.0
+ Method getClassifier =
Jar.class.getMethod("getClassifier");
Review Comment:
@sdedic I moved the Method reflection to a static initializer and stored in
static final fields. Also caught an obsoleted import and removed it.
Have not squashed nor rebased, but I can do that if/when desired.
--
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