[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[viatra-dev] Pattern matcher API updates
|
Hi all,
today I have merged the second part of the changes that extends the matcher API with Java 8 features such as streams and optionals (related bug [1] and changes [2]). This resulted in breaks in latest generated code structure, thus regenerating pattern matcher code will be required. The console output of the latest CPS demonstrator build [4] illustrates the issue:
Compilation failure:
/jobs/genie.viatra/viatra-examples-cps/workspace/cps/generator/org.eclipse.viatra.examples.cps.generator/src-gen/org/eclipse/viatra/examples/cps/generator/queries/PossibleReceiverType.java:[318]
return rawGetAllMatches(new Object[]{pSender, pReceiverAppType});
Furthermore, the return type of getOneArbitraryMatch was updated not to return null if no match is available but always return a Java Optional. This breaks existing users of the class, but we believe it helps using the query API correctly, as it does not allow us to forget the case where no return value is available.
If you need the old behavior back (that returns null if no match is available), you should replace the following calls
matcher.getOneArbitraryMatch()
to
matcher.getOneArbitraryMatch().orElse(null)
If you notice such issues after downloading a new build of VIATRA, please regenerate all pattern matcher code, and update the getOneArbitraryMatch calls accordingly. If the change seems problematic for any reason, or you notice any further issues, please provide feedback as soon as possible, and I will try to update everything as required.
Best regards,
Zoli
[1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=530727
[2] http://git.eclipse.org/c/viatra/org.eclipse.viatra.git/commit/?id=71cbbc16bd99b02e32286432e9a58e537d397d57
[3] http://git.eclipse.org/c/viatra/org.eclipse.viatra.git/commit/?id=bca1357553b6df41c537aaa4e928026183e68c0d
[4] https://ci.eclipse.org/viatra/job/viatra-examples-cps/827/console
-- Zoltán Ujhelyi
Eclipse Technologies Expert
IncQueryLabs Ltd.