FXMLLoader <?import?> checking code conventions too much?

Guillaume Anctil drakkoon at gmail.com
Thu Jun 5 16:05:10 UTC 2014


Hi,

on a project I work on, the code convention does not follow the Java
standard and class names start with a lower case 'c': "cSomeClass.java"

In the <?import ?> parsing of the FXMLLoader, the loadType function looks
like this:

int i = name.indexOf('.');
int n = name.length();
while (i != -1
    && i < n
    && Character.isLowerCase(name.charAt(i + 1))) {
    i = name.indexOf('.', i + 1);
}

if (i == -1 || i == n) {
    throw new ClassNotFoundException();
}

String packageName = name.substring(0, i);
String className = name.substring(i + 1);


This causes a ClassNotFoundException on our custom controls because of the
lowercase check.

I was wondering if a simple:

int i = name.lastIndexOf('.');

Instead of the lowercase check could be viable. The ClassNotFoundException
would still be thrown later on, when trying to actually load the class.

Is there a reason that I don't see why the convention _must_ be upheld in
this case?

Thanks.


More information about the openjfx-dev mailing list