Compile failure due to class name not matching file name
Closed this issue · 4 comments
First off, great work and project!
The following files did not compile for me when using maven due to different casing of file name and class name. So these files (or classes) should be renamed. As these are generated classes, the necessary changes might need to be done in the generating code. The problems were (old name -> fixed name):
OauthTokens.java -> OAuthTokens.java
Emailman.java -> EmailMan.java
AclActions.java -> ACLActions.java
Eapm.java -> EAPM.java
AclRoles.java -> ACLRoles.java
Sugarfeed.java -> SugarFeed.java
Example error:
[ERROR] /home/rrze/unrz/ev29etyn/git/SugarOnRest/sugaronrest/src/main/java/com/sugaronrest/modules/OauthTokens.java:[32,8] class OAuthTokens is public, should be declared in a file named OAuthTokens.java
The java classes are based on SugarCRM table naming. The table names are converted to Pascal cases to create the java class. If a table name is email_man java class name will be EmailMan.java; emailman will be Emailman.java. The intention is to make it as generic as possible.
If this is a problem for majority of users, then we can make an exception.
"First off, great work and project!"
Thanks for the comment. My strong strength is .NET. The .NET version - SugarRestSharp - is on Nuget that I am super familiar with. If your strength is in Java and you would like to help push this or your forked version to central servers for Maven, Gradle etc, I will appreciate that.
The java classes are based on SugarCRM table naming. The table names are converted to Pascal cases to create the java class. If a table name is email_man java class name will be EmailMan.java; emailman will be Emailman.java. The intention is to make it as generic as possible.
If this is a problem for majority of users, then we can make an exception
I see. The problem is the standard javac compiler from the Oracle JDK enforces the file name/class name rule (that they have to be identical) when the class is public. So when the code should compile, we have to make some exceptions here. I can send a push request for this later.