• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java XCatchClause类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.eclipse.xtext.xbase.XCatchClause的典型用法代码示例。如果您正苦于以下问题:Java XCatchClause类的具体用法?Java XCatchClause怎么用?Java XCatchClause使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



XCatchClause类属于org.eclipse.xtext.xbase包,在下文中一共展示了XCatchClause类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: checkCatchClausesOrder

import org.eclipse.xtext.xbase.XCatchClause; //导入依赖的package包/类
@Check
public void checkCatchClausesOrder(XTryCatchFinallyExpression expression) {
	ITypeReferenceOwner owner = new StandardTypeReferenceOwner(getServices(), expression);
	List<LightweightTypeReference> previousTypeReferences = new ArrayList<LightweightTypeReference>();
	for (XCatchClause catchClause : expression.getCatchClauses()) {
		LightweightTypeReference actualTypeReference = owner.toLightweightTypeReference(catchClause.getDeclaredParam().getParameterType());
		if (actualTypeReference == null) {
			continue;
		}
		if (isHandled(actualTypeReference, previousTypeReferences)) {
			error("Unreachable code: The catch block can never match. It is already handled by a previous condition.", catchClause.getDeclaredParam().getParameterType(), null, IssueCodes.UNREACHABLE_CATCH_BLOCK);
			continue;
		}
		previousTypeReferences.add(actualTypeReference);
	}
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:17,代码来源:XbaseValidator.java


示例2: caseXTryCatchFinallyExpression

import org.eclipse.xtext.xbase.XCatchClause; //导入依赖的package包/类
@Override
public Boolean caseXTryCatchFinallyExpression(XTryCatchFinallyExpression object) {
	List<XCatchClause> clauses = object.getCatchClauses();
	if (clauses.isEmpty()) {
		return Boolean.TRUE;
	}
	final List<LightweightTypeReference> caughtExceptions = Lists.newArrayList();
	boolean wasThrowable = false;
	for(XCatchClause clause: clauses) {
		JvmTypeReference caught = clause.getDeclaredParam().getParameterType();
		if (caught != null) {
			LightweightTypeReference caughtException = delegate.toLightweightReference(caught).getRawTypeReference();
			if (caughtException.isType(Throwable.class)) {
				wasThrowable = true;
			}
			caughtExceptions.add(caughtException);
		}
		delegate.collectThrownExceptions(clause.getExpression());
	}
	delegate.collectThrownExceptions(object.getFinallyExpression());
	if (wasThrowable) {
		return Boolean.FALSE;
	}
	delegate.catchExceptions(caughtExceptions).collectThrownExceptions(object.getExpression());
	return Boolean.FALSE;
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:27,代码来源:ThrownExceptionSwitch.java


示例3: appendCatchClause

import org.eclipse.xtext.xbase.XCatchClause; //导入依赖的package包/类
protected void appendCatchClause(XCatchClause catchClause, boolean parentIsReferenced, String parentVariable,
		ITreeAppendable appendable) {
	JvmTypeReference type = catchClause.getDeclaredParam().getParameterType();
	final String declaredParamName = makeJavaIdentifier(catchClause.getDeclaredParam().getName());
	final String name = appendable.declareVariable(catchClause.getDeclaredParam(), declaredParamName);
	appendable.append("if (").append(parentVariable).append(" instanceof ");
	serialize(type, catchClause, appendable);
	appendable.append(") ").append("{");
	appendable.increaseIndentation();
	ITreeAppendable withDebugging = appendable.trace(catchClause, true);
	if (!XbaseUsageCrossReferencer.find(catchClause.getDeclaredParam(), catchClause.getExpression()).isEmpty()) {
		ITreeAppendable parameterAppendable = withDebugging.trace(catchClause.getDeclaredParam());
		appendCatchClauseParameter(catchClause, type, name, parameterAppendable.newLine());
		withDebugging.append(" = (");
		serialize(type, catchClause, withDebugging);
		withDebugging.append(")").append(parentVariable).append(";");
	}
	final boolean canBeReferenced = parentIsReferenced && ! isPrimitiveVoid(catchClause.getExpression());
	internalToJavaStatement(catchClause.getExpression(), withDebugging, canBeReferenced);
	if (canBeReferenced) {
		appendable.newLine().append(getVarName(catchClause.eContainer(), appendable)).append(" = ");
		internalToConvertedExpression(catchClause.getExpression(), appendable, getLightweightType((XExpression) catchClause.eContainer()));
		appendable.append(";");
	}
	closeBlock(appendable);
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:27,代码来源:XbaseCompiler.java


示例4: eSet

import org.eclipse.xtext.xbase.XCatchClause; //导入依赖的package包/类
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue)
{
	switch (featureID)
	{
		case XbasePackage.XTRY_CATCH_FINALLY_EXPRESSION__EXPRESSION:
			setExpression((XExpression)newValue);
			return;
		case XbasePackage.XTRY_CATCH_FINALLY_EXPRESSION__FINALLY_EXPRESSION:
			setFinallyExpression((XExpression)newValue);
			return;
		case XbasePackage.XTRY_CATCH_FINALLY_EXPRESSION__CATCH_CLAUSES:
			getCatchClauses().clear();
			getCatchClauses().addAll((Collection<? extends XCatchClause>)newValue);
			return;
	}
	super.eSet(featureID, newValue);
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:25,代码来源:XTryCatchFinallyExpressionImpl.java


示例5: _exitPoints

import org.eclipse.xtext.xbase.XCatchClause; //导入依赖的package包/类
protected Collection<IEarlyExitComputer.ExitPoint> _exitPoints(final XTryCatchFinallyExpression expression) {
  Collection<IEarlyExitComputer.ExitPoint> tryExitPoints = this.getExitPoints(expression.getExpression());
  boolean _isNotEmpty = this.isNotEmpty(tryExitPoints);
  if (_isNotEmpty) {
    Collection<IEarlyExitComputer.ExitPoint> result = Lists.<IEarlyExitComputer.ExitPoint>newArrayList(tryExitPoints);
    EList<XCatchClause> _catchClauses = expression.getCatchClauses();
    for (final XCatchClause catchClause : _catchClauses) {
      {
        Collection<IEarlyExitComputer.ExitPoint> catchExitPoints = this.getExitPoints(catchClause.getExpression());
        boolean _isNotEmpty_1 = this.isNotEmpty(catchExitPoints);
        if (_isNotEmpty_1) {
          result.addAll(catchExitPoints);
        } else {
          return this.getExitPoints(expression.getFinallyExpression());
        }
      }
    }
    return result;
  }
  return this.getExitPoints(expression.getFinallyExpression());
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:22,代码来源:DefaultEarlyExitComputer.java


示例6: sequence_XCatchClause

import org.eclipse.xtext.xbase.XCatchClause; //导入依赖的package包/类
/**
 * Contexts:
 *     XCatchClause returns XCatchClause
 *
 * Constraint:
 *     (declaredParam=FullJvmFormalParameter expression=XExpression)
 */
protected void sequence_XCatchClause(ISerializationContext context, XCatchClause semanticObject) {
	if (errorAcceptor != null) {
		if (transientValues.isValueTransient(semanticObject, XbasePackage.Literals.XCATCH_CLAUSE__DECLARED_PARAM) == ValueTransient.YES)
			errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, XbasePackage.Literals.XCATCH_CLAUSE__DECLARED_PARAM));
		if (transientValues.isValueTransient(semanticObject, XbasePackage.Literals.XCATCH_CLAUSE__EXPRESSION) == ValueTransient.YES)
			errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, XbasePackage.Literals.XCATCH_CLAUSE__EXPRESSION));
	}
	SequenceFeeder feeder = createSequencerFeeder(context, semanticObject);
	feeder.accept(grammarAccess.getXCatchClauseAccess().getDeclaredParamFullJvmFormalParameterParserRuleCall_2_0(), semanticObject.getDeclaredParam());
	feeder.accept(grammarAccess.getXCatchClauseAccess().getExpressionXExpressionParserRuleCall_4_0(), semanticObject.getExpression());
	feeder.finish();
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:20,代码来源:AbstractXbaseSemanticSequencer.java


示例7: checkTypes

import org.eclipse.xtext.xbase.XCatchClause; //导入依赖的package包/类
@Check
public void checkTypes(XCatchClause catchClause) {
	LightweightTypeReference parameterType = getActualType(catchClause, catchClause.getDeclaredParam());
	if (parameterType != null && !parameterType.isSubtypeOf(Throwable.class)) {
		error("No exception of type " + parameterType.getHumanReadableName()
				+ " can be thrown; an exception type must be a subclass of Throwable",
				catchClause.getDeclaredParam(), TypesPackage.Literals.JVM_FORMAL_PARAMETER__PARAMETER_TYPE,
				ValidationMessageAcceptor.INSIGNIFICANT_INDEX, INCOMPATIBLE_TYPES);
	}
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:11,代码来源:XbaseValidator.java


示例8: appendCatchAndFinally

import org.eclipse.xtext.xbase.XCatchClause; //导入依赖的package包/类
protected void appendCatchAndFinally(XTryCatchFinallyExpression expr, ITreeAppendable b, boolean isReferenced) {
	final EList<XCatchClause> catchClauses = expr.getCatchClauses();
	if (!catchClauses.isEmpty()) {
		String variable = b.declareSyntheticVariable(Tuples.pair(expr, "_catchedThrowable"), "_t");
		b.append(" catch (final Throwable ").append(variable).append(") ");
		b.append("{").increaseIndentation();
		b.newLine();
		Iterator<XCatchClause> iterator = catchClauses.iterator();
		while (iterator.hasNext()) {
			XCatchClause catchClause = iterator.next();
			ITreeAppendable catchClauseAppendable = b.trace(catchClause);
			appendCatchClause(catchClause, isReferenced, variable, catchClauseAppendable);
			if (iterator.hasNext()) {
				b.append(" else ");
			}
		}
		b.append(" else {");
		b.increaseIndentation();
		final JvmType sneakyThrowType = findKnownTopLevelType(Exceptions.class, expr);
		if (sneakyThrowType == null) {
			b.append("COMPILE ERROR : '"+Exceptions.class.getCanonicalName()+"' could not be found on the classpath!");
		} else {
			b.newLine().append("throw ");
			b.append(sneakyThrowType);
			b.append(".sneakyThrow(");
			b.append(variable);
			b.append(");");
		}
		closeBlock(b);
		closeBlock(b);
	}
	final XExpression finallyExp = expr.getFinallyExpression();
	if (finallyExp != null) {
		b.append(" finally {").increaseIndentation();
		internalToJavaStatement(finallyExp, b, false);
		b.decreaseIndentation().newLine().append("}");
	}
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:39,代码来源:XbaseCompiler.java


示例9: getCatchClauses

import org.eclipse.xtext.xbase.XCatchClause; //导入依赖的package包/类
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public EList<XCatchClause> getCatchClauses()
{
	if (catchClauses == null)
	{
		catchClauses = new EObjectContainmentEList<XCatchClause>(XCatchClause.class, this, XbasePackage.XTRY_CATCH_FINALLY_EXPRESSION__CATCH_CLAUSES);
	}
	return catchClauses;
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:14,代码来源:XTryCatchFinallyExpressionImpl.java


示例10: _findImplicitReturns

import org.eclipse.xtext.xbase.XCatchClause; //导入依赖的package包/类
protected void _findImplicitReturns(final XTryCatchFinallyExpression expression, final ImplicitReturnFinder.Acceptor acceptor) {
  this.findImplicitReturns(expression.getExpression(), acceptor);
  final Consumer<XCatchClause> _function = (XCatchClause it) -> {
    this.findImplicitReturns(it.getExpression(), acceptor);
  };
  expression.getCatchClauses().forEach(_function);
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:8,代码来源:XbaseImplicitReturnFinder.java


示例11: doTestTryCatchExpression

import org.eclipse.xtext.xbase.XCatchClause; //导入依赖的package包/类
protected void doTestTryCatchExpression(XTryCatchFinallyExpression tryEx) {
	assertFeatureCall("foo", ((XThrowExpression)tryEx.getExpression()).getExpression());
	assertFeatureCall("baz", tryEx.getFinallyExpression());
	
	assertEquals(1,tryEx.getCatchClauses().size());
	XCatchClause clause = tryEx.getCatchClauses().get(0);
	assertFeatureCall("bar", clause.getExpression());
	assertEquals("java.lang.Exception", clause.getDeclaredParam().getParameterType().getIdentifier());
	assertEquals("e", clause.getDeclaredParam().getName());
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:11,代码来源:XbaseParserTest.java


示例12: doTestTryCatchExpression_2

import org.eclipse.xtext.xbase.XCatchClause; //导入依赖的package包/类
protected void doTestTryCatchExpression_2(XTryCatchFinallyExpression tryEx) {
	assertFeatureCall("foo", tryEx.getExpression());
	assertNull(tryEx.getFinallyExpression());
	
	assertEquals(1,tryEx.getCatchClauses().size());
	XCatchClause clause = tryEx.getCatchClauses().get(0);
	assertFeatureCall("bar", clause.getExpression());
	assertEquals("java.lang.Exception", clause.getDeclaredParam().getParameterType().getIdentifier());
	assertEquals("e", clause.getDeclaredParam().getName());
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:11,代码来源:XbaseParserTest.java


示例13: testTryCatchExpression

import org.eclipse.xtext.xbase.XCatchClause; //导入依赖的package包/类
@Test public void testTryCatchExpression() throws Exception {
	XTryCatchFinallyExpression exp = (XTryCatchFinallyExpression)  
			expressionWithExpectedType("try null catch (java.lang.Throwable t) null finally null", "String");

	assertExpected("java.lang.String", exp.getExpression());
	for (XCatchClause cc : exp.getCatchClauses()) {
		assertExpected("java.lang.String", cc.getExpression());
	}
	assertExpected(null, exp.getFinallyExpression());
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:11,代码来源:XbaseExpectedTypeProviderTest.java


示例14: testTryCatch

import org.eclipse.xtext.xbase.XCatchClause; //导入依赖的package包/类
@Test
public void testTryCatch() {
  try {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("try 1 catch(Exception e) 2");
    XExpression _expression = this.expression(_builder);
    final XTryCatchFinallyExpression expr = ((XTryCatchFinallyExpression) _expression);
    this.hasImplicitReturns(expr, expr.getExpression(), IterableExtensions.<XCatchClause>head(expr.getCatchClauses()).getExpression());
  } catch (Throwable _e) {
    throw Exceptions.sneakyThrow(_e);
  }
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:13,代码来源:ImplicitReturnFinderTest.java


示例15: sequence_XCatchClause

import org.eclipse.xtext.xbase.XCatchClause; //导入依赖的package包/类
/**
 * Constraint:
 *     (declaredParam=FullJvmFormalParameter expression=XExpression)
 */
protected void sequence_XCatchClause(EObject context, XCatchClause semanticObject) {
	if(errorAcceptor != null) {
		if(transientValues.isValueTransient(semanticObject, XbasePackage.Literals.XCATCH_CLAUSE__EXPRESSION) == ValueTransient.YES)
			errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, XbasePackage.Literals.XCATCH_CLAUSE__EXPRESSION));
		if(transientValues.isValueTransient(semanticObject, XbasePackage.Literals.XCATCH_CLAUSE__DECLARED_PARAM) == ValueTransient.YES)
			errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, XbasePackage.Literals.XCATCH_CLAUSE__DECLARED_PARAM));
	}
	INodesForEObjectProvider nodes = createNodeProvider(semanticObject);
	SequenceFeeder feeder = createSequencerFeeder(semanticObject, nodes);
	feeder.accept(grammarAccess.getXCatchClauseAccess().getDeclaredParamFullJvmFormalParameterParserRuleCall_2_0(), semanticObject.getDeclaredParam());
	feeder.accept(grammarAccess.getXCatchClauseAccess().getExpressionXExpressionParserRuleCall_4_0(), semanticObject.getExpression());
	feeder.finish();
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:18,代码来源:AbstractCheckSemanticSequencer.java


示例16: isValueExpectedRecursive

import org.eclipse.xtext.xbase.XCatchClause; //导入依赖的package包/类
protected boolean isValueExpectedRecursive(XExpression expr) {
	EStructuralFeature feature = expr.eContainingFeature();
	EObject container = expr.eContainer();
	
	// is part of block
	if (container instanceof XBlockExpression) {
		XBlockExpression blockExpression = (XBlockExpression) container;
		final List<XExpression> expressions = blockExpression.getExpressions();
		if (expressions.get(expressions.size()-1) != expr) {
			return false;
		}
	}
	// no expectation cases
	if (feature == XbasePackage.Literals.XTRY_CATCH_FINALLY_EXPRESSION__FINALLY_EXPRESSION
		|| feature == XbasePackage.Literals.XABSTRACT_WHILE_EXPRESSION__BODY
		|| feature == XbasePackage.Literals.XFOR_LOOP_EXPRESSION__EACH_EXPRESSION) {
		return false;
	}
	// is value expected
	if (container instanceof XAbstractFeatureCall 
		|| container instanceof XConstructorCall
		|| container instanceof XAssignment
		|| container instanceof XVariableDeclaration
		|| container instanceof XReturnExpression
		|| container instanceof XThrowExpression
		|| feature == XbasePackage.Literals.XFOR_LOOP_EXPRESSION__FOR_EXPRESSION
		|| feature == XbasePackage.Literals.XSWITCH_EXPRESSION__SWITCH
		|| feature == XbasePackage.Literals.XCASE_PART__CASE
		|| feature == XbasePackage.Literals.XIF_EXPRESSION__IF
		|| feature == XbasePackage.Literals.XABSTRACT_WHILE_EXPRESSION__PREDICATE
		|| feature == XbasePackage.Literals.XBASIC_FOR_LOOP_EXPRESSION__EXPRESSION
		|| feature == XbasePackage.Literals.XSYNCHRONIZED_EXPRESSION__PARAM) {
		return true;
	}
	if (isLocalClassSemantics(container) || logicalContainerProvider.getLogicalContainer(expr) != null) {
		LightweightTypeReference expectedReturnType = typeResolver.resolveTypes(expr).getExpectedReturnType(expr);
		return expectedReturnType == null || !expectedReturnType.isPrimitiveVoid();
	}
	if (container instanceof XCasePart || container instanceof XCatchClause) {
		container = container.eContainer();
	}
	if (container instanceof XExpression) {
		return isValueExpectedRecursive((XExpression) container);
	}
	return true;
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:47,代码来源:XbaseValidator.java


示例17: caseXCatchClause

import org.eclipse.xtext.xbase.XCatchClause; //导入依赖的package包/类
@Override
public Boolean caseXCatchClause(XCatchClause object) {
	return Boolean.TRUE;
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:5,代码来源:ThrownExceptionSwitch.java


示例18: isIntentionalEarlyExit

import org.eclipse.xtext.xbase.XCatchClause; //导入依赖的package包/类
/**
 * Returns <code>true</code> for expressions that seem to be early exit expressions, e.g.
 * <pre>
 *   while(condition) {
 *     if (anotherCondition)
 *       return value
 *     changeResultOfFirstCondition
 *   }
 * </pre>
 */
public boolean isIntentionalEarlyExit(/* @Nullable */ XExpression expression) {
	if (expression == null) {
		return true;
	}
	if (expression instanceof XBlockExpression) {
		XBlockExpression block = (XBlockExpression) expression;
		List<XExpression> children = block.getExpressions();
		for(XExpression child: children) {
			if (isIntentionalEarlyExit(child)) {
				return true;
			}
		}
	} else if (expression instanceof XIfExpression) {
		return isIntentionalEarlyExit(((XIfExpression) expression).getThen()) 
				|| isIntentionalEarlyExit(((XIfExpression) expression).getElse());
	} else if (expression instanceof XSwitchExpression) {
		XSwitchExpression switchExpression = (XSwitchExpression) expression;
		for(XCasePart caseExpression: switchExpression.getCases()) {
			if (isIntentionalEarlyExit(caseExpression.getThen())) {
				return true;
			}
		}
		if (isIntentionalEarlyExit(switchExpression.getDefault())) {
			return true;
		}
	} else if (expression instanceof XTryCatchFinallyExpression) {
		XTryCatchFinallyExpression tryCatchFinally = (XTryCatchFinallyExpression) expression;
		if (isIntentionalEarlyExit(tryCatchFinally.getExpression())) {
			for(XCatchClause catchClause: tryCatchFinally.getCatchClauses()) {
				if (!isIntentionalEarlyExit(catchClause.getExpression()))
					return false;
			}
			return true;
		}
		return false;
	} else if (expression instanceof XAbstractWhileExpression) {
		return isIntentionalEarlyExit(((XAbstractWhileExpression) expression).getBody());
	} else if (expression instanceof XForLoopExpression) {
		return isIntentionalEarlyExit(((XForLoopExpression) expression).getEachExpression());
	} else if (expression instanceof XBasicForLoopExpression) {
		return isIntentionalEarlyExit(((XBasicForLoopExpression) expression).getEachExpression());
	} else if (expression instanceof XSynchronizedExpression) {
		return isIntentionalEarlyExit(((XSynchronizedExpression) expression).getExpression());
	}
	return expression instanceof XReturnExpression || expression instanceof XThrowExpression;
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:57,代码来源:ExtendedEarlyExitComputer.java


示例19: isDefiniteEarlyExit

import org.eclipse.xtext.xbase.XCatchClause; //导入依赖的package包/类
public boolean isDefiniteEarlyExit(XExpression expression) {
	// TODO further improvements
	if (expression instanceof XIfExpression) {
		XIfExpression ifExpression = (XIfExpression) expression;
		return isDefiniteEarlyExit(ifExpression.getThen()) && isDefiniteEarlyExit(ifExpression.getElse());
	} else if (expression instanceof XSwitchExpression) {
		XSwitchExpression switchExpression = (XSwitchExpression) expression;
		if (isDefiniteEarlyExit(switchExpression.getDefault())) {
			for(XCasePart caseExpression: switchExpression.getCases()) {
				if (!isDefiniteEarlyExit(caseExpression.getThen())) {
					return false;
				}
			}
			return true;
		}
		return false;
	} else if (expression instanceof XTryCatchFinallyExpression) {
		XTryCatchFinallyExpression tryExpression = (XTryCatchFinallyExpression) expression;
		if (isDefiniteEarlyExit(tryExpression.getFinallyExpression())) {
			return true;
		}
		if (isDefiniteEarlyExit(tryExpression.getExpression())) {
			for(XCatchClause catchClause: tryExpression.getCatchClauses()) {
				if (!isDefiniteEarlyExit(catchClause.getExpression())) {
					return false;
				}
			}
			return true;
		}
		return false;
	} else if (expression instanceof XBlockExpression) {
		List<XExpression> expressions = ((XBlockExpression) expression).getExpressions();
		for(int i = expressions.size() - 1; i >= 0; i--) {
			if (isDefiniteEarlyExit(expressions.get(i))) {
				return true;
			}
		}
	} else if (expression instanceof XSynchronizedExpression) {
		return isDefiniteEarlyExit(((XSynchronizedExpression) expression).getExpression());
	}
	return expression instanceof XReturnExpression || expression instanceof XThrowExpression;
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:43,代码来源:ExtendedEarlyExitComputer.java


示例20: appendCatchClauseParameter

import org.eclipse.xtext.xbase.XCatchClause; //导入依赖的package包/类
protected void appendCatchClauseParameter(XCatchClause catchClause, JvmTypeReference parameterType, final String parameterName, ITreeAppendable appendable) {
	appendable.append("final ");
	serialize(parameterType, catchClause, appendable);
	appendable.append(" ");
	appendable.trace(catchClause.getDeclaredParam(), TypesPackage.Literals.JVM_FORMAL_PARAMETER__NAME, 0).append(parameterName);
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:7,代码来源:XbaseCompiler.java



注:本文中的org.eclipse.xtext.xbase.XCatchClause类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ChatType类代码示例发布时间:2022-05-22
下一篇:
Java Fix类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap