You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by ge...@apache.org on 2019/06/15 04:11:19 UTC

[netbeans] branch master updated: [NETBEANS-2519] Fixing automatic module name generation when the module name has trailing digits. (#1274)

This is an automated email from the ASF dual-hosted git repository.

geertjan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git


The following commit(s) were added to refs/heads/master by this push:
     new 6480ac1  [NETBEANS-2519] Fixing automatic module name generation when the module name has trailing digits. (#1274)
6480ac1 is described below

commit 6480ac1dacec758c49f7c6534dd1d51d99e121b8
Author: Jan Lahoda <jl...@netbeans.org>
AuthorDate: Sat Jun 15 06:11:08 2019 +0200

    [NETBEANS-2519] Fixing automatic module name generation when the module name has trailing digits. (#1274)
---
 .../src/org/netbeans/modules/java/source/ModuleNames.java            | 1 -
 .../unit/src/org/netbeans/modules/java/source/ModuleNamesTest.java   | 5 +++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/java/java.source.base/src/org/netbeans/modules/java/source/ModuleNames.java b/java/java.source.base/src/org/netbeans/modules/java/source/ModuleNames.java
index b4b7562..8509b69 100644
--- a/java/java.source.base/src/org/netbeans/modules/java/source/ModuleNames.java
+++ b/java/java.source.base/src/org/netbeans/modules/java/source/ModuleNames.java
@@ -359,7 +359,6 @@ public final class ModuleNames {
             moduleName = moduleName.substring(0, start);
         }
         moduleName =  moduleName
-            .replaceAll("(\\.|\\d)*$", "")    // remove trailing version
             .replaceAll("[^A-Za-z0-9]", ".")  // replace non-alphanumeric
             .replaceAll("(\\.)(\\1)+", ".")   // collapse repeating dots
             .replaceAll("^\\.", "")           // drop leading dots
diff --git a/java/java.source.base/test/unit/src/org/netbeans/modules/java/source/ModuleNamesTest.java b/java/java.source.base/test/unit/src/org/netbeans/modules/java/source/ModuleNamesTest.java
index d177add..f9b66af 100644
--- a/java/java.source.base/test/unit/src/org/netbeans/modules/java/source/ModuleNamesTest.java
+++ b/java/java.source.base/test/unit/src/org/netbeans/modules/java/source/ModuleNamesTest.java
@@ -128,6 +128,7 @@ public class ModuleNamesTest extends NbTestCase {
         try {
             FileObject mod1 = FileUtil.getArchiveRoot(jar(wd, "app-core-1.0.jar", null).get());    //NOI18N
             final FileObject mod2 = FileUtil.getArchiveRoot(jar(wd,"app-main-1.0.jar", null).get());     //NOI18N
+            final FileObject mod3 = FileUtil.getArchiveRoot(jar(wd,"app-util2-1.0.jar", null).get());     //NOI18N
             String moduleName = names.getModuleName(mod1.toURL(), false);
             assertEquals("app.core", moduleName);   //NOI18N
             assertTrue(th.isCalculated());
@@ -167,6 +168,10 @@ public class ModuleNamesTest extends NbTestCase {
             assertTrue(th.isCalculated());
             assertEquals("org.me.app.core", moduleName);    //NOI18N
             th.reset();
+            moduleName = names.getModuleName(mod3.toURL(), false);
+            assertEquals("app.util2", moduleName);   //NOI18N
+            assertTrue(th.isCalculated());
+            th.reset();
         } finally {
             th.unregister();
         }


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