This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 188686
Collapse All | Expand All

(-)a/openide.modules/apichanges.xml (+17 lines)
Lines 50-55 Link Here
50
  	<apidef name="modules">Modules API</apidef>
50
  	<apidef name="modules">Modules API</apidef>
51
  </apidefs>
51
  </apidefs>
52
<changes>
52
<changes>
53
    <change id="Allow.Keywords">
54
        <api name="modules"/>
55
        <summary>Module names can contain java keywords</summary>
56
        <version major="7" minor="19"/>
57
        <date day="23" month="7" year="2010"/>
58
        <author login="jtulach"/>
59
        <compatibility addition="yes"/>
60
        <description>
61
            <p>
62
                Naming rules for module code name bases are now relaxed.
63
                The name of a module can contain a Java keyword and can 
64
                also start with a number.
65
            </p>
66
        </description>
67
        <class package="org.openide.modules" name="Dependency"/>
68
        <issue number="188686"/>
69
    </change>
53
    <change id="ClassLoader.findLibrary">
70
    <change id="ClassLoader.findLibrary">
54
        <api name="modules"/>
71
        <api name="modules"/>
55
        <summary>New native library lookup mechanism</summary>
72
        <summary>New native library lookup mechanism</summary>
(-)a/openide.modules/manifest.mf (-1 / +1 lines)
Lines 1-5 Link Here
1
Manifest-Version: 1.0
1
Manifest-Version: 1.0
2
OpenIDE-Module: org.openide.modules
2
OpenIDE-Module: org.openide.modules
3
OpenIDE-Module-Localizing-Bundle: org/openide/modules/Bundle.properties
3
OpenIDE-Module-Localizing-Bundle: org/openide/modules/Bundle.properties
4
OpenIDE-Module-Specification-Version: 7.18
4
OpenIDE-Module-Specification-Version: 7.19
5
5
(-)a/openide.modules/src/org/openide/modules/Dependency.java (-1 / +24 lines)
Lines 203-217 Link Here
203
        }
203
        }
204
204
205
        boolean expectingPath = true;
205
        boolean expectingPath = true;
206
        boolean first = true;
206
207
207
        while (tok.hasMoreTokens()) {
208
        while (tok.hasMoreTokens()) {
208
            if (expectingPath) {
209
            if (expectingPath) {
209
                expectingPath = false;
210
                expectingPath = false;
210
211
211
                String nt = tok.nextToken();
212
                String nt = tok.nextToken();
212
                if (!Utilities.isJavaIdentifier(nt) &&  !"enum".equals (nt)) { // NOI18N
213
                if (!isJavaIdentifierOrNumber(nt, first)) {
213
                    throw new IllegalArgumentException("Bad package component in " + base); // NOI18N
214
                    throw new IllegalArgumentException("Bad package component in " + base); // NOI18N
214
                }
215
                }
216
                first = false;
215
            } else {
217
            } else {
216
                if (!".".equals(tok.nextToken())) { // NOI18N
218
                if (!".".equals(tok.nextToken())) { // NOI18N
217
                    throw new NumberFormatException("Expected dot in code name: " + base); // NOI18N
219
                    throw new NumberFormatException("Expected dot in code name: " + base); // NOI18N
Lines 221-227 Link Here
221
            }
223
            }
222
        }
224
        }
223
    }
225
    }
226
    
227
    private static boolean isJavaIdentifierOrNumber(String id, boolean requireLetter) {
228
        if (id == null) {
229
            return false;
230
        }
224
231
232
        if (id.equals("")) {
233
            return false;
234
        }
235
        if (requireLetter) {
236
            if (!(java.lang.Character.isJavaIdentifierStart(id.charAt(0)))) {
237
                return false;
238
            }
239
        }
240
        for (int i = 0; i < id.length(); i++) {
241
            if (!(java.lang.Character.isJavaIdentifierPart(id.charAt(i)))) {
242
                return false;
243
            }
244
        }
245
        return true;
246
    }
247
    
225
    /** Parse dependencies from tags.
248
    /** Parse dependencies from tags.
226
    * @param type like Dependency.type
249
    * @param type like Dependency.type
227
    * @param body actual text of tag body; if <code>null</code>, returns nothing
250
    * @param body actual text of tag body; if <code>null</code>, returns nothing
(-)a/openide.modules/test/unit/src/org/openide/modules/DependencyTest.java (+10 lines)
Lines 58-63 Link Here
58
        super(name);
58
        super(name);
59
    }
59
    }
60
60
61
    public void testAllowJavaKeywordsInModuleNames() throws Exception {
62
        Set<Dependency> single = Dependency.create(Dependency.TYPE_MODULE, "acme.j2ee.webapp.import");
63
        assertEquals("One item created: " + single, 1, single.size());
64
    }
65
66
    public void testAllowNumbersInModuleNames() throws Exception {
67
        Set<Dependency> single = Dependency.create(Dependency.TYPE_MODULE, "acme.2.webapp.importing");
68
        assertEquals("One item created: " + single, 1, single.size());
69
    }
70
    
61
    public void testParseModule() throws Exception {
71
    public void testParseModule() throws Exception {
62
        Set singleton = Dependency.create(Dependency.TYPE_MODULE, "org.foo.bar/1 > 1.1");
72
        Set singleton = Dependency.create(Dependency.TYPE_MODULE, "org.foo.bar/1 > 1.1");
63
        assertTrue(singleton.size() == 1);
73
        assertTrue(singleton.size() == 1);

Return to bug 188686