--- a/openide.modules/apichanges.xml Thu Jul 15 09:33:57 2010 +0200 +++ a/openide.modules/apichanges.xml Thu Jul 15 10:23:16 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 and can + also start with a number. +

+
+ + +
New native library lookup mechanism --- a/openide.modules/manifest.mf Thu Jul 15 09:33:57 2010 +0200 +++ a/openide.modules/manifest.mf Thu Jul 15 10:23:16 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 --- a/openide.modules/src/org/openide/modules/Dependency.java Thu Jul 15 09:33:57 2010 +0200 +++ a/openide.modules/src/org/openide/modules/Dependency.java Thu Jul 15 10:23:16 2010 +0200 @@ -203,15 +203,17 @@ } boolean expectingPath = true; + boolean first = true; while (tok.hasMoreTokens()) { if (expectingPath) { expectingPath = false; String nt = tok.nextToken(); - if (!Utilities.isJavaIdentifier(nt) && !"enum".equals (nt)) { // NOI18N + if (!isJavaIdentifierOrNumber(nt, first)) { throw new IllegalArgumentException("Bad package component in " + base); // NOI18N } + first = false; } else { if (!".".equals(tok.nextToken())) { // NOI18N throw new NumberFormatException("Expected dot in code name: " + base); // NOI18N @@ -221,7 +223,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 --- a/openide.modules/test/unit/src/org/openide/modules/DependencyTest.java Thu Jul 15 09:33:57 2010 +0200 +++ a/openide.modules/test/unit/src/org/openide/modules/DependencyTest.java Thu Jul 15 10:23:16 2010 +0200 @@ -58,6 +58,16 @@ 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 testAllowNumbersInModuleNames() throws Exception { + Set single = Dependency.create(Dependency.TYPE_MODULE, "acme.2.webapp.importing"); + assertEquals("One item created: " + single, 1, single.size()); + } + public void testParseModule() throws Exception { Set singleton = Dependency.create(Dependency.TYPE_MODULE, "org.foo.bar/1 > 1.1"); assertTrue(singleton.size() == 1);