[QVTO] Problems with blackboxing [message #84761] |
Thu, 19 June 2008 02:14  |
Eclipse User |
|
|
|
Originally posted by: stenzel.informatik.uni-augsburg.de
Hi Radek,
I tried to use the blackboxing example that you gave in this newsgroup,
but it doesn't work for me. The QVT editor/compiler can load the library,
and shows the type of the dumpErr method correctly as
dumpErr(String : String) : oclstdlib::OclAny - oclstdlib::OclAny
However, when I run the transformation I get a NullPointerException in
org.eclipse.m2m.internal.qvt.oml.ocl.transformations.Library OperationImpl.isMethodApplicable(LibraryOperationImpl.java:1 44)
(complete stack trace below). Do you have any idea what could be wrong?
I also tried to create a library method without invoking argument (with
OclVoid), but I couldn't load the library. No matter what I tried I got an
ArrayIndexOutOfBoundsException (perhaps related to argument parsing). Can
you give an example how it should work?
Thanks in advance,
Kurt
|
|
|
|
Re: [QVTO] Problems with blackboxing [message #84790 is a reply to message #84761] |
Thu, 19 June 2008 09:33   |
Eclipse User |
|
|
|
Hi Kurt,
Unfortunately, there is nothing that you do wrong, but we do.
You have found a bug, https://bugs.eclipse.org/bugs/show_bug.cgi?id=3D23=
7781
The problem appears if the return type is OclAny, OclVoid.
See the java lib example bellow to support your usecase.
It just gets arround this by using a correctly handled return type and
may be called like bellow.
main {
dumpError('HELP!!!!');
}
.....
public class HelperLibrary {
=
public Boolean dumpError(String argStr) {
System.err.println(argStr);
return Boolean.TRUE;
}
=
public static class Metainfo {
/**
* array[0] - Context classifier
* array[n] - Classifier corresponds to the n-th operation =
=
parameter
* array[n+1] - Return type classifier
*/ =
private static final String[] DUMP_ERROR_INFO =3D new String[] =
{
"oclstdlib::OclVoid", // Void context -> module owned =
(context-less) operation
// imported library module is the =
implicit source object of the call
"oclstdlib::String", // your string argument
"oclstdlib::Boolean" // return type
};
=
public static final String[] dumpError(String str) {
return DUMP_ERROR_INFO;
}
}
Regards,
/Radek
On Thu, 19 Jun 2008 08:14:50 +0200, Kurt Stenzel =
<stenzel@informatik.uni-augsburg.de> wrote:
> Hi Radek,
>
> I tried to use the blackboxing example that you gave in this newsgroup=
,
> but it doesn't work for me. The QVT editor/compiler can load the libra=
ry,
> and shows the type of the dumpErr method correctly as dumpErr(String :=
=
> String) : oclstdlib::OclAny - oclstdlib::OclAny
>
> However, when I run the transformation I get a NullPointerException in=
> org.eclipse.m2m.internal.qvt.oml.ocl.transformations.Library OperationI=
mpl.isMethodApplicable(LibraryOperationImpl.java:144)
>
> (complete stack trace below). Do you have any idea what could be wrong=
?
> I also tried to create a library method without invoking argument (wit=
h =
> OclVoid), but I couldn't load the library. No matter what I tried I go=
t =
> an
> ArrayIndexOutOfBoundsException (perhaps related to argument parsing). =
Can
> you give an example how it should work?
>
> Thanks in advance,
>
> Kurt
>
-- =
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
|
|
|
|
Re: [QVTO] Problems with blackboxing [message #84942 is a reply to message #84928] |
Mon, 23 June 2008 07:36  |
Eclipse User |
|
|
|
Hi Kurt,
Sorry, If I confused you a bit here, System.err was just a simple example
and
I assumed you would have a specific redirection of the output.
If you are OK with using the default console of your running launch
configuration,
you could use the standard QVT log expression. See the example bellow:
helper dumpError(in msg : String) : OclVoid {
log('[ERROR] ' + msg); -- std QVT log expression
}
mapping UML::Model::model2RsdsdDBModel() : RDB::Model {
init {
dumpError('My error message...');
}
}
The code above causes the following output in the console associated with
your QVT launch configuration.
[ERROR] My error message...
So far, we do not provide any access to a QVT dedicated console but you
still can add your own console implementation
to be used by your error reporting written in Java.
For sure, we plan to implement a better support for console logging after
Ganymede release.
Regards,
/Radek
On Mon, 23 Jun 2008 12:20:15 +0200, Kurt Stenzel
<stenzel@informatik.uni-augsburg.de> wrote:
> Hi Radek,
>
> thanks for your help. Now my method is called. However, System.out and
> System.err seem to be directed somewhere. At least my output does not
> appear on the Console.
>
> Thanks again,
>
> Kurt
>
>
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
|
|
|
Powered by
FUDForum. Page generated in 0.07139 seconds