Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions extide/gradle/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@

<property name="test-unit-sys-prop.test.data.dir" location="test/data"/>
<property name="tooling" value="netbeans-gradle-tooling"/>
<property name="gradle.version" value="7.4" />
<property name="gradle.version" value="8.11.1" />

<target name="-process.release.files" depends="projectized.-process.release.files">
<unzip src="external/gradle-${gradle.version}-bin.zip" dest="external">
<patternset>
<include name="gradle-${gradle.version}/lib/gradle-wrapper-${gradle.version}.jar"/>
<include name="gradle-${gradle.version}/lib/plugins/gradle-wrapper-main-${gradle.version}.jar"/>
</patternset>
<globmapper from="*" to="gradle-wrapper-${gradle.version}-wrapper.jar"/>
</unzip>
Expand Down
2 changes: 1 addition & 1 deletion extide/gradle/external/binaries-list
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
# specific language governing permissions and limitations
# under the License.

483F39DCC23C3FB098C00E6A14E0AEBE3D10F00C https://services.gradle.org/distributions/gradle-7.4-bin.zip gradle-7.4-bin.zip
C26B6A81460F9AC40D4CB2911E8FA87F462E6AD8 https://services.gradle.org/distributions/gradle-8.11.1-bin.zip gradle-8.11.1-bin.zip
1 change: 0 additions & 1 deletion extide/gradle/external/gradle-7.4-bin-notice.txt

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Name: Gradle
Description: Gradle Build System
Version: 7.4
Version: 8.11.1
License: Gradle
Origin: Gradle Inc.
URL: https://gradle.org/
Expand Down Expand Up @@ -386,10 +386,11 @@ org.eclipse.jgit:org.eclipse.jgit
------------------------------------------------------------------------------
BSD-style

com.jcraft:jsch
com.jcraft:jzlib
com.github.mwiede:jsch

Copyright (c) 2000-2011 ymnk, JCraft,Inc. All rights reserved.
Copyright (c) 2002-2015 Atsuhiko Yamanaka, JCraft,Inc.
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Expand Down
21 changes: 21 additions & 0 deletions extide/gradle/external/gradle-8.11.1-bin-notice.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
=========================================================================
== NOTICE file corresponding to the section 4 d of ==
== the Apache License, Version 2.0, ==
== in this case for the Gradle distribution. ==
=========================================================================

This product includes software developed by
The Apache Software Foundation (http://www.apache.org/).

It includes the following other software:

Groovy (http://groovy-lang.org)
SLF4J (http://www.slf4j.org)
JUnit (http://www.junit.org)
JCIFS (http://jcifs.samba.org)
HttpClient (https://hc.apache.org/httpcomponents-client-4.5.x/)

For licenses, see the LICENSE file.

If any software distributed with Gradle does not have an Apache 2 License, its license is explicitly listed in the
LICENSE file.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Name: Gradle Wrapper
Description: Gradle Wrapper
Version: 7.4
Version: 8.11.1
License: Apache-2.0
Origin: Gradle Inc.
URL: https://gradle.org/
Expand Down
2 changes: 1 addition & 1 deletion extide/gradle/nbproject/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ extra.module.files=\
# These properties are used for compiling the netbeans-gradle-tooling library
# It shall be built on the lowest language level that the Gradle integration supports
tooling.javac.release=8
tooling.gradle.version=7.4
tooling.gradle.version=8.11.1
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=../../../external/gradle-7.4-bin.zip
distributionUrl=../../../external/gradle-8.11.1-bin.zip
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public void setModel(NbProjectInfoModel model) {
}

protected boolean isFixedValue(String description, ValueSupplier.ExecutionTimeValue etv) {
return etv.isFixedValue();
return etv.hasFixedValue();
}

public boolean isMutableType(Object potentialValue) {
Expand Down Expand Up @@ -192,17 +192,17 @@ protected <T, E extends Throwable> Optional<T> safeCall(ExceptionCallable<T, E>
}
}

public static class Gradle76 extends GradleInternalAdapter {
public static class GradlePre76 extends GradleInternalAdapter {
private static Optional<Method> refHasValue;

public Gradle76(Project project) {
public GradlePre76(Project project) {
super(project);
}

@Override
protected boolean isFixedValue(String description, ValueSupplier.ExecutionTimeValue etv) {
if (refHasValue == null) {
refHasValue = safeCall(() -> ValueSupplier.ExecutionTimeValue.class.getMethod("hasFixedValue"), "Gradle 7.6+ ExecutionTimeValue");
refHasValue = safeCall(() -> ValueSupplier.ExecutionTimeValue.class.getMethod("isFixedValue"), "Gradle <7.6 ExecutionTimeValue");
}
if (refHasValue.isPresent()) {
return safeCall(() -> (Boolean)refHasValue.get().invoke(etv), description).orElse(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ public ValueAndType(Class type) {

NbProjectInfoBuilder(Project project) {
this.project = project;
this.adapter = sinceGradleOrDefault("7.6", () -> new GradleInternalAdapter.Gradle76(project), () -> new GradleInternalAdapter(project));
this.adapter = sinceGradleOrDefault("7.6", () -> new GradleInternalAdapter(project), () -> new GradleInternalAdapter.GradlePre76(project));
}

private NbProjectInfoModel model = new NbProjectInfoModel();
Expand Down Expand Up @@ -367,11 +367,19 @@ private String dependenciesAsString(Task t, TaskDependency td) {
}

private void detectConfigurationArtifacts(NbProjectInfoModel model) {
// JDK-8301046: Don't use Configuration::getName as a method reference. The bug, when
// compiling `Configuration::getName` against Gradle >= 8.4, causes javac to pick the
// wrong receiver target (invokeinterface on Named::getName) in the lambda bootstrap
// method params rather than the (correct per JLS) invokevirtual on the callsite's
// erasure type (Configuration). This will break at runtime when calling Gradle <8.4,
// as in earlier versions the Configuration class does not implement Named, and throws
// a BootstrapMethodError wrapping a LambdaConversionException. The lambda form:
// `c -> c.getName()` bootstraps correctly but costs an extra method def/indirection.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this explanation

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this reminded me on this old PR #4864

List<Configuration> configs = project.getConfigurations()
.stream()
.filter(Configuration::isCanBeConsumed)
.filter(c -> !c.isCanBeResolved())
.sorted(Comparator.comparing(Configuration::getName))
.sorted(Comparator.comparing(c -> c.getName())) // JDK-8301046
.collect(Collectors.toList());
Map<String, Object> data = new HashMap<>();
for (Configuration c : configs) {
Expand Down Expand Up @@ -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");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please could you cache the Method objects at the Builder level or at least in the method ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this made me curious so I wrote a quick JMH benchmark:

    private static final List<?> LIST = List.of("1");
    private static final Method METHOD;
    
    static {
        Method m = null;
        try {
            m = List.class.getMethod("getFirst");
        } catch (NoSuchMethodException ex) {
            throw new IllegalStateException(ex);
        }
        METHOD = m;
    }

    /*
    JDK 25.0.0
    Benchmark                  Mode  Cnt    Score   Error  Units
    ReflectionJMH.reference    avgt    5    0.390 ± 0.009  ns/op
    ReflectionJMH.constMethod  avgt    5    1.098 ± 0.004  ns/op
    ReflectionJMH.getMethod    avgt    5  114.503 ± 1.479  ns/op
    */

    @Benchmark
    public void reference(Blackhole bh) throws ReflectiveOperationException {
        bh.consume(LIST.getFirst());
    }

    @Benchmark
    public void getMethod(Blackhole bh) throws ReflectiveOperationException {
        bh.consume(List.class.getMethod("getFirst").invoke(LIST));
    }

    @Benchmark
    public void constMethod(Blackhole bh) throws ReflectiveOperationException {
        bh.consume(METHOD.invoke(LIST));
    }

having it as constant makes still a big difference. Also interesting that the JVM couldn't completely eliminate the reflective overhead of the static constant based invocation.

(but take this with a grain of salt, micro benchmarks are always tricky, method call overhead can also go down in the noise if the method is actually doing something non-trivial)

Method getArchivePath = Jar.class.getMethod("getArchivePath");
return jar -> {
try {
archives.put((String) getClassifier.invoke(jar), (File) getArchivePath.invoke(jar));
} catch (ReflectiveOperationException e) {
sneakyThrow(e);
}
};
});
project.getTasks().withType(Jar.class).forEach(jarToArchivesClassifierAndPath);
model.getInfo().put("archives", archives);
}

Expand Down Expand Up @@ -1567,17 +1581,7 @@ private void detectDependencies(NbProjectInfoModel model) {
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);
}
};
},
() -> dep -> project.findProject(dep.getPath()), // getPath() added in Gradle 8.11
() -> ProjectDependency::getDependencyProject); // removed in Gradle 9

visibleConfigurations.forEach(it -> {
Expand Down Expand Up @@ -1884,22 +1888,25 @@ interface ExceptionCallable<T, E extends Throwable> {
private static <T extends Throwable> void sneakyThrow(Throwable exception) throws T {
throw (T) exception;
}

private <T, E extends Throwable> T sinceGradleOrDefault(String version, ExceptionCallable<T, E> c, Supplier<T> def) {

private <T, E extends Throwable> T sinceGradleOrDefault(
String version, ExceptionCallable<T, E> c, ExceptionCallable<T, E> def) {
ExceptionCallable<T, E> impl;
if (GRADLE_VERSION.compareTo(GradleVersion.version(version)) >= 0) {
try {
return c.call();
} catch (RuntimeException | Error e) {
throw e;
} catch (Throwable t) {
sneakyThrow(t);
return null;
}
impl = c;
} else if (def != null) {
return def.get();
impl = def;
} else {
return null;
}
try {
return impl.call();
} catch (RuntimeException | Error e) {
throw e;
} catch (Throwable t) {
sneakyThrow(t);
return null;
}
}

private <T, E extends Throwable> T sinceGradle(String version, ExceptionCallable<T, E> c) {
Expand Down
22 changes: 9 additions & 13 deletions nbbuild/antsrc/org/netbeans/nbbuild/extlibs/ignored-overlaps
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,15 @@ enterprise/websvc.restlib/external/jakarta.xml.bind-api-2.3.3.jar ide/xml.jaxb.a
enterprise/websvc.restlib/external/osgi.core-8.0.0.jar platform/libs.osgi/external/osgi.core-8.0.0.jar

# gradle is used at build-time, so we can ignore the duplicates
extide/gradle/external/gradle-7.4-bin.zip enterprise/libs.amazon/external/ion-java-1.0.2.jar
extide/gradle/external/gradle-7.4-bin.zip ide/c.google.guava.failureaccess/external/failureaccess-1.0.3.jar
extide/gradle/external/gradle-7.4-bin.zip ide/c.jcraft.jzlib/external/jzlib-1.1.3.jar
extide/gradle/external/gradle-7.4-bin.zip ide/libs.commons_compress/external/commons-compress-1.27.1.jar
extide/gradle/external/gradle-7.4-bin.zip ide/o.apache.commons.lang/external/commons-lang-2.6.jar
extide/gradle/external/gradle-7.4-bin.zip ide/o.eclipse.jgit/external/org.eclipse.jgit-7.2.0.202503040940-r.jar
extide/gradle/external/gradle-7.4-bin.zip java/debugger.jpda.truffle/external/antlr4-runtime-4.7.2.jar
extide/gradle/external/gradle-7.4-bin.zip java/maven.embedder/external/apache-maven-3.9.11-bin.zip
extide/gradle/external/gradle-7.4-bin.zip platform/libs.junit4/external/hamcrest-core-1.3.jar
extide/gradle/external/gradle-7.4-bin.zip platform/libs.junit4/external/junit-4.13.2.jar
extide/gradle/external/gradle-7.4-bin.zip platform/libs.testng/external/jcommander-1.78.jar
extide/gradle/external/gradle-7.4-bin.zip enterprise/cloud.oracle/external/httpclient-4.5.13.jar
extide/gradle/external/gradle-7.4-bin.zip platform/o.apache.commons.codec/external/commons-codec-1.18.0.jar
extide/gradle/external/gradle-8.11.1-bin.zip extide/o.apache.tools.ant.module/external/apache-ant-1.10.14-bin.zip
extide/gradle/external/gradle-8.11.1-bin.zip ide/o.apache.commons.lang/external/commons-lang-2.6.jar
extide/gradle/external/gradle-8.11.1-bin.zip ide/slf4j.api/external/slf4j-api-1.7.36.jar
extide/gradle/external/gradle-8.11.1-bin.zip java/maven.embedder/external/apache-maven-3.9.11-bin.zip
extide/gradle/external/gradle-8.11.1-bin.zip nbbuild/external/jsoup-1.15.3.jar
extide/gradle/external/gradle-8.11.1-bin.zip platform/libs.junit4/external/hamcrest-core-1.3.jar
extide/gradle/external/gradle-8.11.1-bin.zip platform/libs.junit4/external/junit-4.13.2.jar
extide/gradle/external/gradle-8.11.1-bin.zip platform/libs.junit5/external/opentest4j-1.3.0.jar
extide/gradle/external/gradle-8.11.1-bin.zip platform/libs.testng/external/jcommander-1.78.jar

# These are the endorsed version of the javaee apis and create libraries, so they are better kept separate
enterprise/javaee.api/external/javax.annotation-api-1.2.jar enterprise/javaee7.api/external/javax.annotation-api-1.2.jar
Expand Down
5 changes: 3 additions & 2 deletions nbbuild/licenses/Gradle
Original file line number Diff line number Diff line change
Expand Up @@ -377,10 +377,11 @@ org.eclipse.jgit:org.eclipse.jgit
------------------------------------------------------------------------------
BSD-style

com.jcraft:jsch
com.jcraft:jzlib
com.github.mwiede:jsch

Copyright (c) 2000-2011 ymnk, JCraft,Inc. All rights reserved.
Copyright (c) 2002-2015 Atsuhiko Yamanaka, JCraft,Inc.
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Expand Down