Skip to content
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

Fix for issue 969 and issue 986 #990

Merged
merged 5 commits into from Feb 4, 2017
Merged

Conversation

AdamBJ
Copy link
Contributor

@AdamBJ AdamBJ commented Feb 4, 2017

Description

Fixes the "Not having return types for methods" issue (969) for Java and Php (not for C++, I've created a seperate issue for the C++ guys).

As part of the investigating 969, I uncovered issues relating to the generation of "main" methods and associated threading code in Java (the investigation formed its own issue, (986)). Essentially, the test to determine if a method was a Java main method wasn't rigorous enough. This has been fixed and the threading code is generating properly now (i.e. only if public static (void) main(String[] args) is present)

Additionally, I looked into why the threading code being generated for a Java main method wasn't consistent from run to run. The problem was that a JUnit test wasn't cleaning up after itself, and has also been fixed.

Tests

Several tests have been added (and a few existing tests have been modified) to fully verify the correctness of the generated main methods and associated threading code, as well as to verify that void is being added to Java methods that don't specify a return type.

Closes #969, #968

…eturn type that is not a constructor returns "void" in the generated output. This fixes issue 969

-Modified SampleFileWriter_Code.ump so that expected and actual output is compared properly during assertUmpleTemplateFor(). This fixes issue 984, but is included in this commit because the fix is also necessary to fix issue 969 as the two issues share many test cases (JUnit can't be green for either issue unless they are both fixed).
…issue 969 (984 and 969 don't need to be worked on together after all).
… Java sense of the term) are correctly generated by Umple.

- Removed the "is this a main method check" from UmpleInternalParser_CodeClass.ump. Since what it means to have a "main function" varies from language to language (e.g. compare Java where the main method is the main entry point into a program and PhP where it's just another method) this check should be done and the results processed during code generation.
- Changed the "is this a main method check" in class_MethodDeclaration.ump to include a check for "void" and "String[] args"
- Added several new test cases to verify the main check and subsequent code generation is behaving correctly
- Added a "tearDown" method to DistributedClassTest.java that cleans up the mainMainClass static variable before moving to the next test set. Without the tearDown method the state from DistributedClassTest.java was being carried over to JavaClassTemplateTest.java, which was causing intermittent code generation issues.
… the user explicitly includes "void" in the .ump file.
…erated3.ump (it was identical to ClassTemplateTest_Generated2.java.txt and ClassTemplateTest_Generated2.ump
@vahdat-ab vahdat-ab merged commit 9f6ff7d into umple:master Feb 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants