New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unnecessary String variable "outputString" in generated Java code #947

Closed
AdamBJ opened this Issue Jan 15, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@AdamBJ
Contributor

AdamBJ commented Jan 15, 2017

Brief Description

When Umple Online generates the toString() method for Java code, it is often creating a unnecessary extra variable, outputString, as shown in the example below:

public String toString()
{
String outputString = "";
return super.toString() + "["+
"z" + ":" + getZ()+ "]"
+ outputString;
}

We should fix this issue, and check if it is occuring in other contexts (e.g. in other generated languages, outside of Umple Online).

Minimum Steps to Reproduce

Look at the toString() method in the generated Java code associated with this example from the Umple manual.

Expected Result

outputString should not be created nor used.

Actual Result

outputSting is being created and used.

Omitting the build log output as this issue is occurring when using Umple Online.

Assignees

I would like to look into this issue during the code sprint this coming weekend (January 20th-22nd).

@AdamBJ AdamBJ self-assigned this Jan 15, 2017

@AdamBJ

This comment has been minimized.

Contributor

AdamBJ commented Jan 30, 2017

@vahdat-ab I've got a fix for this in my local repo. The problem is that there are about 200 template test cases that need to be changed to remove references to the extra string. I know Tim said to be careful when changing test cases, but I think in this case it should be ok?

@vahdat-ab

This comment has been minimized.

Member

vahdat-ab commented Jan 30, 2017

yup. I would say check each one before deleting to see if you can find an exception :-)

@vahdat-ab vahdat-ab closed this Jan 31, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment