<-- Back

Java compilation error when using 'String' as entity name

Issue

When using 'String' as an entity name, Studio Pro throws the below Java compilation error:

C:\Users\<UserName>\Documents\Mendix\<Project name>\javasource\myfirstmodule\proxies\classname.java:29: error: cannot find symbol
[javac]throw new java.lang.IllegalArgumentException(String.format("The given object is not a %s", entityName));
[javac] ^
[javac]symbol: method format(java.lang.String,java.lang.String)
[javac]location: class myfirstmodule.proxies.String

Environment

Studio Pro version 8.1.0 to 9.14.2

Cause

This issue is caused when an entity is named 'String' inside the Domain model, as it is a reserved word. In Mendix, a reserved word is a term or identifier that has a special, predefined meaning within the Mendix platform and cannot be used as a custom identifier in your applications. These words are “reserved” for specific purposes in the Mendix language and development environment.

Solution/Workaround

  • Rename the entity 'String' to a different name, and run the project to fix this issue.
  • Alternatively, upgrade the project to Studio Pro 9.15.0 or a newer version to fix the issue.

Internal information related

  • 147900, 243018, 147093 
  • SOLP-943 

Additional information 

Below is a list of words that either throw a warning beforehand, throw an error when trying to run, or do not throw an error at all while used in Studio Pro version 8.1.0 to 9.14.2.

StringStudio Pro throws error during compilation
LongStudio Pro provides a warning that the word is reserved
IntegerAllowed to run
Hashed stringStudio Pro provides a warning that the name is not in the proper format
EnumerationAllowed to run
DecimalAllowed to run
Date and timeStudio Pro provides a warning that the name is not in the proper format
BooleanStudio Pro provides a warning that the word is reserved
BinaryAllowed to run
AutoNumberAllowed to run

 

Have more questions? Submit a request

0 Comments

Article is closed for comments.

To provide feedback, please open a ticket here. Don't forget to include the article's URL along with the feedback you would like to provide.