Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

VIATRA/Query/UserDocumentation/PureWhitelist

< VIATRA‎ | Query
Revision as of 09:24, 23 June 2015 by Harmath.incquerylabs.com (Talk | contribs) (create)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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.incquery.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