diff -r db53bc96fafc openide.modules/apichanges.xml --- a/openide.modules/apichanges.xml Thu Jul 15 09:33:57 2010 +0200 +++ b/openide.modules/apichanges.xml Fri Jul 16 11:18:47 2010 +0200 @@ -50,6 +50,23 @@ Modules API + + + Module names can contain java keywords + + + + + +

+ Naming rules for module code name bases are now relaxed. + The name of a module can contain a Java keyword like + org.mysite.import.something, etc. +

+
+ + +
New native library lookup mechanism diff -r db53bc96fafc openide.modules/manifest.mf --- a/openide.modules/manifest.mf Thu Jul 15 09:33:57 2010 +0200 +++ b/openide.modules/manifest.mf Fri Jul 16 11:18:47 2010 +0200 @@ -1,5 +1,5 @@ Manifest-Version: 1.0 OpenIDE-Module: org.openide.modules OpenIDE-Module-Localizing-Bundle: org/openide/modules/Bundle.properties -OpenIDE-Module-Specification-Version: 7.18 +OpenIDE-Module-Specification-Version: 7.19 diff -r db53bc96fafc openide.modules/src/org/openide/modules/Dependency.java --- a/openide.modules/src/org/openide/modules/Dependency.java Thu Jul 15 09:33:57 2010 +0200 +++ b/openide.modules/src/org/openide/modules/Dependency.java Fri Jul 16 11:18:47 2010 +0200 @@ -203,13 +203,12 @@ } boolean expectingPath = true; - while (tok.hasMoreTokens()) { if (expectingPath) { expectingPath = false; String nt = tok.nextToken(); - if (!Utilities.isJavaIdentifier(nt) && !"enum".equals (nt)) { // NOI18N + if (!isJavaIdentifierOrNumber(nt, true)) { throw new IllegalArgumentException("Bad package component in " + base); // NOI18N } } else { @@ -221,7 +220,28 @@ } } } + + private static boolean isJavaIdentifierOrNumber(String id, boolean requireLetter) { + if (id == null) { + return false; + } + if (id.equals("")) { + return false; + } + if (requireLetter) { + if (!(java.lang.Character.isJavaIdentifierStart(id.charAt(0)))) { + return false; + } + } + for (int i = 0; i < id.length(); i++) { + if (!(java.lang.Character.isJavaIdentifierPart(id.charAt(i)))) { + return false; + } + } + return true; + } + /** Parse dependencies from tags. * @param type like Dependency.type * @param body actual text of tag body; if null, returns nothing diff -r db53bc96fafc openide.modules/test/unit/src/org/openide/modules/DependencyTest.java --- a/openide.modules/test/unit/src/org/openide/modules/DependencyTest.java Thu Jul 15 09:33:57 2010 +0200 +++ b/openide.modules/test/unit/src/org/openide/modules/DependencyTest.java Fri Jul 16 11:18:47 2010 +0200 @@ -58,6 +58,28 @@ super(name); } + public void testAllowJavaKeywordsInModuleNames() throws Exception { + Set single = Dependency.create(Dependency.TYPE_MODULE, "acme.j2ee.webapp.import"); + assertEquals("One item created: " + single, 1, single.size()); + } + + public void testForNumbersInModuleNamesAreDisallowed() throws Exception { + try { + Set single = Dependency.create(Dependency.TYPE_MODULE, "acme.2.webapp.importing"); + fail("Shall throw an exception: " + single); + } catch (IllegalArgumentException ex) { + // fine + } + } + public void testForNumbersInModuleNamesAreDisallowed2() throws Exception { + try { + Set single = Dependency.create(Dependency.TYPE_MODULE, "acme.2xyz.webapp.importing"); + fail("Shall throw an exception: " + single); + } catch (IllegalArgumentException ex) { + // fine + } + } + public void testParseModule() throws Exception { Set singleton = Dependency.create(Dependency.TYPE_MODULE, "org.foo.bar/1 > 1.1"); assertTrue(singleton.size() == 1);