CA Gen standard Java Proxy build fails with "cannot override getClass()"
search cancel

CA Gen standard Java Proxy build fails with "cannot override getClass()"


Article ID: 140993


Updated On:


Gen Gen - Workstation Toolset


CA Gen 8.6 standard Java Proxy generation/build fails with below error. I am able to generate/build the Classic Style Java Proxy for the same server and I am able to build standard style Java proxy for other servers. 

    [javac] C:\Users\Administrator\Documents\CA\Gen 8.6\Models\model1.ief\proxy\java\src\ServerName\PackageName\ error: getClass() in ExportViewNameEntityName cannot override getClass() in Object
    [javac]     public short getClass() {
    [javac]                  ^
    [javac]   overridden method is final
    [javac] Note: C:\Users\Administrator\Documents\CA\Gen 8.6\Models\model1.ief\proxy\java\src\ServerName\packagename\ uses or overrides a deprecated API.
    [javac] Note: Recompile with -Xlint:deprecation for details.
    [javac] 1 error
    [javac] 1 warning

C:\Users\Administrator\Documents\CA\Gen 8.6\Models\model1.ief\proxy\java\Server_Name.XML:154: Compile failed; see the compiler error output for details


Release : 8.6
Component : CA Gen Workstation Toolset


The root cause of the error is that Procedure Step PStepName has an Export view attribute whose name is "CLASS" which is a reserved word for the Java language. Gen does not perform reserved word checking for generated language reserved words.

The standard Java Proxy generated code in file declares a get method to get each entity attribute (property) and thus for an attribute with name "CLASS" it declares "public short getClass()" whose name conflicts with the standard Java method getClass().

The Classic Style Java Proxy generated code is not as object-oriented as the newer standard Java Proxy and it does not declare those attribute (property) classes, so there is no conflict with the standard Java method getClass().


In the Gen model go to the entity referred to in build error (ExportViewNameEntityName) and it will have an attribute "CLASS" whose name needs to be changed. Checking the properties of attribute "CLASS" if the option "Set TD Name to the attribute name" is unchecked then changing the attribute name will have no negative impact on the Data Structure TD name (Database column name) which is used at application runtime by the Procedure Step PStepName.
The alternative workaround is to generate/build the Classic Style Java Proxy.