Java Code Examples for org.eclipse.xtext.xbase.XAssignment#isStatic()

The following examples show how to use org.eclipse.xtext.xbase.XAssignment#isStatic() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SARLValidator.java    From sarl with Apache License 2.0 5 votes vote down vote up
@Override
protected boolean isInitialized(JvmField input) {
	if (super.isInitialized(input)) {
		return true;
	}
	// Check initialization into a static constructor.
	final XtendField sarlField = (XtendField) this.associations.getPrimarySourceElement(input);
	if (sarlField == null) {
		return false;
	}
	final XtendTypeDeclaration declaringType = sarlField.getDeclaringType();
	if (declaringType == null) {
		return false;
	}
	for (final XtendConstructor staticConstructor : Iterables.filter(Iterables.filter(
			declaringType.getMembers(), XtendConstructor.class), it -> it.isStatic())) {
		if (staticConstructor.getExpression() != null) {
			for (final XAssignment assign : EcoreUtil2.getAllContentsOfType(staticConstructor.getExpression(), XAssignment.class)) {
				if (assign.isStatic() && Strings.equal(input.getIdentifier(), assign.getFeature().getIdentifier())) {
					// Mark the field as initialized in order to be faster during the next initialization test.
					this.readAndWriteTracking.markInitialized(input, null);
					return true;
				}
			}
		}
	}
	return false;
}
 
Example 2
Source File: FeatureLinkingCandidate.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
protected boolean isImplicitlyStatic(XAssignment assignment) {
	return assignment.isStatic() && isTypeLiteral(assignment.getAssignable());
}