Skip to main content
Jump to: navigation, search

Difference between revisions of "VIATRA/Query/UserDocumentation/PureWhitelist"

< VIATRA‎ | Query
(Update to VIATRA Query 1.2)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
 +
{{caution|Old information|This page is not updated anymore; for more up-to-date details look at the query language documentation at https://www.eclipse.org/viatra/documentation/query-language.html instead.}}
 
By default, check()/eval() constraints do not support calling arbitrary Java methods, since they are generally assumed to be impure. However, if you have a pure method and want to call it in these types of constraints, you have two options:  
 
By default, check()/eval() constraints do not support calling arbitrary Java methods, since they are generally assumed to be impure. However, if you have a pure method and want to call it in these types of constraints, you have two options:  
 
* if it is implemented by you, annotate it with the <tt>@Pure</tt> annotation of Xbase (<tt>org.eclipse.xtext.xbase.lib.Pure</tt>)
 
* if it is implemented by you, annotate it with the <tt>@Pure</tt> annotation of Xbase (<tt>org.eclipse.xtext.xbase.lib.Pure</tt>)

Latest revision as of 15:28, 14 November 2017

Stop.png
Old information
This page is not updated anymore; for more up-to-date details look at the query language documentation at https://www.eclipse.org/viatra/documentation/query-language.html instead.

By default, check()/eval() constraints do not support calling arbitrary Java methods, since they are generally assumed to be impure. However, if you have a pure method and want to call it in these types of constraints, you have two options:

  • if it is implemented by you, annotate it with the @Pure annotation of Xbase (org.eclipse.xtext.xbase.lib.Pure)
  • if it comes from a third-party library, register it via the org.eclipse.viatra.query.patternlanguage.purewhitelist extension point

Some standard library methods are marked as pure by default, including:

  • java.lang.Math
  • java.lang.String

Back to the top