wrprice commented on code in PR #8810:
URL: https://github.com/apache/netbeans/pull/8810#discussion_r2386308717
##########
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:
@mbien I should've moved them in the first PR, because I had done similar
benchmarks back in 2017. See [slide 40 of this
PDF](https://github.com/wrprice/hjug-jmh-demo/blob/master/presentation/jmh-hjug201607.pdf)
or [this Java
source](https://github.com/wrprice/hjug-jmh-demo/blob/master/src/jmh/java/org/hjug/jmhdemo/ReflectionVsLambdaVsHandles.java).
The biggest surprise at the time was not so much the happy path execution
cost but the *exceptional* path cost!
--
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