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

Stephen F Northover steve.x.northover at oracle.com
Thu Jun 5 18:57:31 UTC 2014


I see no reason why we should enforce this.  Martin, any idea?

Steve

On 2014-06-05, 12:05 PM, Guillaume Anctil wrote:
> 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