You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by lk...@apache.org on 2019/02/12 00:32:25 UTC
[incubator-netbeans] branch master updated: [NETBEANS-2102] Do not
add single files to the Gradle classpath.
This is an automated email from the ASF dual-hosted git repository.
lkishalmi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-netbeans.git
The following commit(s) were added to refs/heads/master by this push:
new 1e18daf [NETBEANS-2102] Do not add single files to the Gradle classpath.
1e18daf is described below
commit 1e18daf90ab180845b0e08df514ce33e3f4dc231
Author: Laszlo Kishalmi <la...@gmail.com>
AuthorDate: Sat Feb 9 17:19:54 2019 -0800
[NETBEANS-2102] Do not add single files to the Gradle classpath.
---
.../classpath/AbstractGradleClassPathImpl.java | 53 +++++++---------------
1 file changed, 16 insertions(+), 37 deletions(-)
diff --git a/groovy/gradle.java/src/org/netbeans/modules/gradle/java/classpath/AbstractGradleClassPathImpl.java b/groovy/gradle.java/src/org/netbeans/modules/gradle/java/classpath/AbstractGradleClassPathImpl.java
index c70c347..69f3732 100644
--- a/groovy/gradle.java/src/org/netbeans/modules/gradle/java/classpath/AbstractGradleClassPathImpl.java
+++ b/groovy/gradle.java/src/org/netbeans/modules/gradle/java/classpath/AbstractGradleClassPathImpl.java
@@ -56,26 +56,22 @@ abstract class AbstractGradleClassPathImpl implements ClassPathImplementation {
protected AbstractGradleClassPathImpl(Project proj) {
this.project = proj;
final NbGradleProject watcher = proj.getLookup().lookup(NbGradleProject.class);
- listener = new PropertyChangeListener() {
-
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- if (watcher.isUnloadable()) {
- return;
- }
- List<URL> newValue = createPath();
- boolean hasChanged;
- synchronized (AbstractGradleClassPathImpl.this) {
- hasChanged = hasChanged(rawResources, newValue);
- if (hasChanged) {
- rawResources = newValue;
- resources = null;
- }
- }
+ listener = (PropertyChangeEvent evt) -> {
+ if (watcher.isUnloadable()) {
+ return;
+ }
+ List<URL> newValue = createPath();
+ boolean hasChanged;
+ synchronized (AbstractGradleClassPathImpl.this) {
+ hasChanged = hasChanged(rawResources, newValue);
if (hasChanged) {
- support.firePropertyChange(ClassPathImplementation.PROP_RESOURCES, null, null);
+ rawResources = newValue;
+ resources = null;
}
}
+ if (hasChanged) {
+ support.firePropertyChange(ClassPathImplementation.PROP_RESOURCES, null, null);
+ }
};
watcher.addPropertyChangeListener(WeakListeners.propertyChange(listener, null));
}
@@ -128,26 +124,9 @@ abstract class AbstractGradleClassPathImpl implements ClassPathImplementation {
static void addAllFile(Collection<URL> ret, @NonNull Collection<File> files) {
assert files != null;
for (File f : files) {
- FileObject fo = FileUtil.toFileObject(f);
- if (fo != null) {
- if (FileUtil.isArchiveFile(fo)) {
- ret.add(FileUtil.getArchiveRoot(fo).toURL());
- } else {
- ret.add(fo.toURL());
- }
- } else {
- try {
- URL url = Utilities.toURI(f).toURL();
- String surl = url.toString();
- if (surl.endsWith(".jar")) { //NOI18N
- url = new URL("jar:" + surl + "!/"); //NOI18N
- } else if (!surl.endsWith("/")) { //NOI18N
- url = new URL(surl + "/"); //NOI18N
- }
- ret.add(url);
- } catch (MalformedURLException ex) {
- //TODO: Shall not happen on files.
- }
+ URL u = FileUtil.urlForArchiveOrDir(f);
+ if (u != null) {
+ ret.add(u);
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists