Home » Modeling » UML2 » type conformance
type conformance [message #470397] |
Tue, 13 February 2007 12:55  |
Eclipse User |
|
|
|
For the following snippet:
Type t = ...
System.out.println(t.conformsTo(t));
This always produces "false" (unless t is a Classifier). A type should
at least conform to itself, shouldn't it?
Rafael
|
|
| | | |
Re: type conformance [message #470412 is a reply to message #470406] |
Wed, 14 February 2007 07:40  |
Eclipse User |
|
|
|
True, I didn't realize that all subclasses of Type are also Classifiers.
Then the spec issue was a red herring. I was having problems and really
thought I saw the behavior I described, I guess based on Type#conformsTo
spec and impl. But as you pointed out, that code is never be executed,
so the behavior I described actually can never happen.
Thanks,
Rafael
Kenn Hussey wrote:
> Note, however, that Classifier is the only specialization of Type in UML,
> and since Type is abstract, in practice you should expect that all types
> (classifiers) from UML conform to themselves...
>
> Kenn
>
> "James Bruck" <jbruck@ca.ibm.com> wrote in message
> news:eqtphb$oj1$1@utils.eclipse.org...
>> Hi Rafael.
>>
>> Have a look at the spec on p. 138 under "Type". It states: " The query
>> conformsTo() gives true for a type that conforms to another. By default,
>> two types do not conform to each other. This query is intended to be
>> redefined for specific conformance situations."
>>
>> So in your code snippet it I would expect the result to always be false.
>>
>> By the way, the documentation for the API (ie have a look at
>> "Type.conformsTo()" ) is derived from the spec so you often don't have to
>> dig your way through the spec to discover the intention behind the public
>> API.
>>
>> Regards,
>>
>> - James.
>>
>>
>> "Rafael Chaves" <chaves@inf.ufsc.nospam.br> wrote in message
>> news:eqsqgo$tbr$1@utils.eclipse.org...
>>> For the following snippet:
>>>
>>> Type t = ...
>>> System.out.println(t.conformsTo(t));
>>>
>>> This always produces "false" (unless t is a Classifier). A type should at
>>> least conform to itself, shouldn't it?
>>>
>>> Rafael
>>
>
>
|
|
|
Re: type conformance [message #588671 is a reply to message #470397] |
Tue, 13 February 2007 20:46  |
Eclipse User |
|
|
|
Hi Rafael.
Have a look at the spec on p. 138 under "Type". It states: " The query
conformsTo() gives true for a type that conforms to another. By default,
two types do not conform to each other. This query is intended to be
redefined for specific conformance situations."
So in your code snippet it I would expect the result to always be false.
By the way, the documentation for the API (ie have a look at
"Type.conformsTo()" ) is derived from the spec so you often don't have to
dig your way through the spec to discover the intention behind the public
API.
Regards,
- James.
"Rafael Chaves" <chaves@inf.ufsc.nospam.br> wrote in message
news:eqsqgo$tbr$1@utils.eclipse.org...
> For the following snippet:
>
> Type t = ...
> System.out.println(t.conformsTo(t));
>
> This always produces "false" (unless t is a Classifier). A type should at
> least conform to itself, shouldn't it?
>
> Rafael
|
|
|
Re: type conformance [message #588683 is a reply to message #470404] |
Tue, 13 February 2007 22:50  |
Eclipse User |
|
|
|
Note, however, that Classifier is the only specialization of Type in UML,
and since Type is abstract, in practice you should expect that all types
(classifiers) from UML conform to themselves...
Kenn
"James Bruck" <jbruck@ca.ibm.com> wrote in message
news:eqtphb$oj1$1@utils.eclipse.org...
> Hi Rafael.
>
> Have a look at the spec on p. 138 under "Type". It states: " The query
> conformsTo() gives true for a type that conforms to another. By default,
> two types do not conform to each other. This query is intended to be
> redefined for specific conformance situations."
>
> So in your code snippet it I would expect the result to always be false.
>
> By the way, the documentation for the API (ie have a look at
> "Type.conformsTo()" ) is derived from the spec so you often don't have to
> dig your way through the spec to discover the intention behind the public
> API.
>
> Regards,
>
> - James.
>
>
> "Rafael Chaves" <chaves@inf.ufsc.nospam.br> wrote in message
> news:eqsqgo$tbr$1@utils.eclipse.org...
>> For the following snippet:
>>
>> Type t = ...
>> System.out.println(t.conformsTo(t));
>>
>> This always produces "false" (unless t is a Classifier). A type should at
>> least conform to itself, shouldn't it?
>>
>> Rafael
>
>
|
|
|
Re: type conformance [message #588689 is a reply to message #470404] |
Tue, 13 February 2007 22:56  |
Eclipse User |
|
|
|
Hi James,
In "t.conformsTo(t)" there is only one type involved, so the rule "two
types do not conform to each other" does not apply here. In other words,
the spec is not complete enough as it does not cover all cases.
The simple idea that a type does not conform to itself gives me a
headache. Unless I totally missed what the semantics of conformsTo is
intended for (I see it as something like
java.lang.Class.isAssignableFrom(Class)).
Thanks,
Rafael
James Bruck wrote:
> Hi Rafael.
> Have a look at the spec on p. 138 under "Type". It states: " The query
> conformsTo() gives true for a type that conforms to another. By default,
> two types do not conform to each other. This query is intended to be
> redefined for specific conformance situations."
> So in your code snippet it I would expect the result to always be false.
> By the way, the documentation for the API (ie have a look at
> "Type.conformsTo()" ) is derived from the spec so you often don't have to
> dig your way through the spec to discover the intention behind the public
> API.
> Regards,
> - James.
> "Rafael Chaves" <chaves@inf.ufsc.nospam.br> wrote in message
> news:eqsqgo$tbr$1@utils.eclipse.org...
>> For the following snippet:
>>
>> Type t = ...
>> System.out.println(t.conformsTo(t));
>>
>> This always produces "false" (unless t is a Classifier). A type should at
>> least conform to itself, shouldn't it?
>>
>> Rafael
|
|
|
Re: type conformance [message #588708 is a reply to message #470406] |
Wed, 14 February 2007 07:40  |
Eclipse User |
|
|
|
True, I didn't realize that all subclasses of Type are also Classifiers.
Then the spec issue was a red herring. I was having problems and really
thought I saw the behavior I described, I guess based on Type#conformsTo
spec and impl. But as you pointed out, that code is never be executed,
so the behavior I described actually can never happen.
Thanks,
Rafael
Kenn Hussey wrote:
> Note, however, that Classifier is the only specialization of Type in UML,
> and since Type is abstract, in practice you should expect that all types
> (classifiers) from UML conform to themselves...
>
> Kenn
>
> "James Bruck" <jbruck@ca.ibm.com> wrote in message
> news:eqtphb$oj1$1@utils.eclipse.org...
>> Hi Rafael.
>>
>> Have a look at the spec on p. 138 under "Type". It states: " The query
>> conformsTo() gives true for a type that conforms to another. By default,
>> two types do not conform to each other. This query is intended to be
>> redefined for specific conformance situations."
>>
>> So in your code snippet it I would expect the result to always be false.
>>
>> By the way, the documentation for the API (ie have a look at
>> "Type.conformsTo()" ) is derived from the spec so you often don't have to
>> dig your way through the spec to discover the intention behind the public
>> API.
>>
>> Regards,
>>
>> - James.
>>
>>
>> "Rafael Chaves" <chaves@inf.ufsc.nospam.br> wrote in message
>> news:eqsqgo$tbr$1@utils.eclipse.org...
>>> For the following snippet:
>>>
>>> Type t = ...
>>> System.out.println(t.conformsTo(t));
>>>
>>> This always produces "false" (unless t is a Classifier). A type should at
>>> least conform to itself, shouldn't it?
>>>
>>> Rafael
>>
>
>
|
|
|
Goto Forum:
Current Time: Wed Jul 23 14:21:34 EDT 2025
Powered by FUDForum. Page generated in 0.04671 seconds
|