Menu

#216 public top-level classname inference

open
nobody
2
2004-06-28
2004-06-28
No

Consider the following file:

class MyPackageClass { ... }
public class MyPublicClass { ... }

DrJava's automatic filename logic merely finds the
first top-level class declaration, so this file would
have its filename suggested as MyPackageClass, even
though javac would require it to be named
MyPublicClass. Ideally, we should determine the
correct public top-level classname if one exists,
defaulting to a package-private class only if no public
class exists.

That said, this is an extremely silly case. Anyone who
writes a public class _after_ a package-private class
in a file can deal with typing the filename in
manually, I think, so it only really matters for a
sense of consistency with Java's rules.

Discussion

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.