UCOSPLogYiranShu

YiranShu edited this page Sep 18, 2018 · 8 revisions

Each UCOSP participant is asked to log all the steps they take as they make progress through the semester. This includes difficulties they faced (getting set up, understanding how to model in Umple, using UmpleOnline, code that is difficult to figure out, and development tools that are hard to figure out, or don't seem to work properly). The more log entries added the more we can better get a grip on the usability issues with Umple, and the more we can help future new contributors come up to speed.

Please record entries in reverse chronological order

Log Entries

2018-09-16

Today, I worked on issue #487. I tested the behavior of UmpleOnline when I input an ordinary "if" statement and a guard in a state machine. The generated code is good when I input an ordinary "if" statement. The problem is related to guard. Here are test cases and results for a guard (On the left of "->" is the original umple code. Generated Java code is on the right hand side):

If a and b are strings,

1. a.equals(b)  ->  getA().equals(getB())          --Right
2. a == b  ->  getA().equals(getB())               --Wrong
3. getA().equals(b)  ->  getA().equals(getB())     --Right
4. getA() == b  ->  getA().equals(getB())          --Wrong

If a and b are boolean variables,

a == b  ->  getA()==getB()                         --Right
getA() == b  ->  getA()==getB()                    --Right
a == getB()  ->  getA()==getB()                    --Right
getA() == getB()  ->  getA().equals(getB())        --Wrong
a == false  ->  getA()==false                      --Right
getA() == false  ->  getA().equals(false)          --Wrong
false == a  ->  false==getA()                      --Right
false == getA()  ->  false.equals(getA())          --Wrong

I looked for patterns in the output. I found if we compare 2 objects, the generator will generate ".equals()" no matter whether we use ".equals()" or "==". If we compare 2 boolean variables, the behavior is complex.

If the boolean variables are both declared in the class, it will generate "==". If the boolean variables are both in the "getSomething()" format, it will generate ".equals()". If one of them is declared in the class, it will generate "==". If we compare a declared boolean variable with "false", it will generate "==". If we compare a boolean method with "false", it will generate ".equals()".

It seems that the generated code is good only if at least one of the stuff we compare is a declared variable. If both of them are functions, "true", "false", undeclared variables, it will generate bad code.

2018-09-12

Today I solved some failures I encountered on 2018-09-08. At first, I thought the failures are due to incompatible version of my Java jdk. But after I reinstalled jdk1.8.0_65 (I used jdk1.8.0_144 previously), the problem still existed. Then I check the failure information provided by Junit. I found: The failure of "CompilerErrorOutputTests" is because of

java.lang.ExceptionInInitializerError
at cruise.compiler.CompilerErrorOutputTests.AbstractMethodTest(CompilerErrorOutputTests.java:80)
Caused by: java.lang.IllegalArgumentException: character to be escaped is missing
at java.util.regex.Matcher.appendReplacement(Matcher.java:809)
at java.util.regex.Matcher.replaceAll(Matcher.java:955)
at java.lang.String.replaceAll(String.java:2223)
at cruise.compiler.CompilerErrorUtil.<clinit>(CompilerErrorUtil.java:15)

The failure of "RuntimeErrorOutputTests" is because of

java.lang.ExceptionInInitializerError
at cruise.runtime.RuntimeErrorOutputTests.InMain(RuntimeErrorOutputTests.java:10)
Caused by: java.lang.IllegalArgumentException: character to be escaped is missing
at java.util.regex.Matcher.appendReplacement(Matcher.java:809)
at java.util.regex.Matcher.replaceAll(Matcher.java:955)
at java.lang.String.replaceAll(String.java:2223)
at cruise.runtime.RuntimeErrorUtil.<clinit>(RuntimeErrorUtil.java:17)

Then I opened CompilerErrorUtil.java and RuntimeErrorUtil.java. Line 15 of CompilerErrorUtil.java and Line 17 of RuntimeErrorUtil.java both use replaceAll("/", File.separator). Since my operating system is Windows 10, File.operator is "\", while on Linux, File.operator is "/". This use of replaceAll method is erroneous. After I replaced replaceAll with replace, The failure of "RuntimeErrorOutputTests" disappeared. However, the failure of CompilerErrorOutputTests still existed.

But the failure information changed, it is due to some errors of the generated Java code in SomePath\umple\testbed\test\cruise\compiler\src-gen-umple. I will work on the errors tomorrow!

2018-09-08

Today I continued the setting up process. Cloned the project from github and built the project. Unfortunately, I encountered some failures.

When I ran the full build: "ant -Dmyenv=wlocal", it said "BUILD SUCCESSFUL" but there indeed existed some failing test cases on the terminal:

testJava:
    [echo] Running JAVA tests via junit
    [junit] WARNING: multiple versions of ant detected in path for junit
    [junit]          jar:file:/D:/project/umple/dist/libs/core/ant.jar!/org/apache/tools/ant/Project.class
    [junit]      and jar:file:/C:/ProgramData/chocolatey/lib/ant/apache-ant-1.10.5/lib/ant.jar!/org/apache/tools/ant/Project.class
    [junit] TEST cruise.compiler.CompilerErrorOutputTests FAILED
    [junit] TEST cruise.runtime.RuntimeErrorOutputTests FAILED
    [junit] Tests FAILED 

But other steps went well. I skipped Step 2d (Setting up local UmpleOnline). I installed the Eclipse IDE for Java EE, the Umple plugin, the IvyDE plugin. I found a mistake on the instruction page (https://github.com/umple/umple/wiki/InstallEclipsePlugin) when I was installing the Umple plugin at Step 2. I think

"PREREQUISITE: Eclipse Modeling tools running"

should be

"PREREQUISITE: Eclipse IDE running".

After the installation, I imported the working copy project and it runs. Tomorrow I will attempt to set up local UmpleOnline and study the architecture of Umple.

2018-09-07

Once I received the email from Timothy, I started to use UmpleOnline. I consulted the manual and knew a little about the syntax of Umple and how it works. Then I finished the first few steps of setting up -- installed PHP 5.6.17, Ruby 2.1.9, Ant 1.10.5 and git 2.18.0.

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.