User is allowed to use primitive type as package name.
marcosantos98 opened this issue · 5 comments
An interesting issue I hadn't considered before. Problematic for sure in the age of floating cities. gdx-setup has the same problem. inb4 TEt comes up with some regex to disallow abstract
, assert
, boolean
, break
, byte
, case
, catch
, char
, class
, const
, continue
, default
, double
, do
, else
, enum
, extends
, false
, final
, finally
, float
, for
, goto
, if
, implements
, import
, instanceof
, int
, interface
, long
, native
, new
, null
, package
, private
, protected
, public
, return
, short
, static
, strictfp
, super
, switch
, synchronized
, this
, throw
, throws
, transient
, true
, try
, void
, volatile
and while
in package names.
It's annoying but not a priority imo.
So, now this does validate to make sure none of the keywords @Frosty-J listed are used, but it also checks for the semi-reserved name _
, and any Win32-reserved file names that can and have caused trouble for me before. Here's a check registering as invalid because LPT2 is a Win32-reserved name:
And the regex wasn't... that bad...
"(?i).*(^|\\.)(abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|double|do|else|enum|extends|false|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|native|new|null|package|private|protected|public|return|short|static|strictfp|super|switch|synchronized|this|throw|throws|transient|true|try|void|volatile|while|_|con|prn|aux|nul|(com[1-9])|(lpt[1-9]))(\\.|$).*"
Good shout. As an elitist non-Windows user, I sometimes forget about the reserved filenames. The Java directory structure may be very different if COM (without a number) was restricted.
Good shout. As an elitist non-Windows user, I sometimes forget about the reserved filenames. The Java directory structure may be very different if COM (without a number) was restricted.
I didn't thought about windows reserved files as well lol. gj