forked from umple/umple
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request umple#866 from umple/issue841
Fix for issue umple#841. Singleton class should not have any subclasses.
- Loading branch information
Showing
8 changed files
with
94 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
E040 Singleton Has Subclasses | ||
Errors and Warnings | ||
noreferences | ||
|
||
@@description | ||
|
||
<h2>Umple semantic error generated when a singleton class has subclasses</h2> | ||
|
||
<p>Singleton is a software pattern to allow only one instance of a class. A singleton class has a private constructor and cannot be inherited.</p> | ||
|
||
<p> | ||
</p> | ||
|
||
@@example | ||
@@source manualexamples/E040_singleton_inherited.ump | ||
@@endexample | ||
|
||
@@example | ||
@@source manualexamples/E040_singleton_inheritedFix.ump | ||
@@endexample | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
cruise.umple/test/cruise/umple/compiler/007_singleton_extended.ump
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
|
||
class Airplane | ||
{ | ||
singleton; | ||
} | ||
class F16 | ||
{ | ||
isA Airplane; | ||
} |
18 changes: 18 additions & 0 deletions
18
cruise.umple/test/cruise/umple/compiler/007_singleton_extended2.ump
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
|
||
class FlyingObject | ||
{ | ||
|
||
} | ||
class Airplane | ||
{ | ||
isA FlyingObject; | ||
singleton; | ||
} | ||
|
||
class Fighters | ||
{ | ||
class F16 | ||
{ | ||
isA Airplane; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
umpleonline/ump/manualexamples/E040_singleton_inherited.ump
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
|
||
// In this example a singleton class has subclasses and it generates an error | ||
class Airplane | ||
{ | ||
singleton; | ||
} | ||
class F16 | ||
{ | ||
isA Airplane; | ||
} |
14 changes: 14 additions & 0 deletions
14
umpleonline/ump/manualexamples/E040_singleton_inheritedFix.ump
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
//I this example the singleton class does not have a subclass and is correct | ||
class Airplane | ||
{ | ||
|
||
} | ||
class TheAirplane | ||
{ | ||
singleton; | ||
} | ||
class F16 | ||
{ | ||
isA Airplane; | ||
} |