本文整理汇总了Java中org.eclipse.jdt.core.dom.ThrowStatement类的典型用法代码示例。如果您正苦于以下问题:Java ThrowStatement类的具体用法?Java ThrowStatement怎么用?Java ThrowStatement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ThrowStatement类属于org.eclipse.jdt.core.dom包,在下文中一共展示了ThrowStatement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: locationNeedsParentheses
import org.eclipse.jdt.core.dom.ThrowStatement; //导入依赖的package包/类
private static boolean locationNeedsParentheses(StructuralPropertyDescriptor locationInParent) {
if (locationInParent instanceof ChildListPropertyDescriptor && locationInParent != InfixExpression.EXTENDED_OPERANDS_PROPERTY) {
// e.g. argument lists of MethodInvocation, ClassInstanceCreation, dimensions of ArrayCreation ...
return false;
}
if (locationInParent == VariableDeclarationFragment.INITIALIZER_PROPERTY
|| locationInParent == SingleVariableDeclaration.INITIALIZER_PROPERTY
|| locationInParent == ReturnStatement.EXPRESSION_PROPERTY
|| locationInParent == EnhancedForStatement.EXPRESSION_PROPERTY
|| locationInParent == ForStatement.EXPRESSION_PROPERTY
|| locationInParent == WhileStatement.EXPRESSION_PROPERTY
|| locationInParent == DoStatement.EXPRESSION_PROPERTY
|| locationInParent == AssertStatement.EXPRESSION_PROPERTY
|| locationInParent == AssertStatement.MESSAGE_PROPERTY
|| locationInParent == IfStatement.EXPRESSION_PROPERTY
|| locationInParent == SwitchStatement.EXPRESSION_PROPERTY
|| locationInParent == SwitchCase.EXPRESSION_PROPERTY
|| locationInParent == ArrayAccess.INDEX_PROPERTY
|| locationInParent == ThrowStatement.EXPRESSION_PROPERTY
|| locationInParent == SynchronizedStatement.EXPRESSION_PROPERTY
|| locationInParent == ParenthesizedExpression.EXPRESSION_PROPERTY) {
return false;
}
return true;
}
示例2: locationNeedsParentheses
import org.eclipse.jdt.core.dom.ThrowStatement; //导入依赖的package包/类
private static boolean locationNeedsParentheses(StructuralPropertyDescriptor locationInParent) {
if (locationInParent instanceof ChildListPropertyDescriptor
&& locationInParent != InfixExpression.EXTENDED_OPERANDS_PROPERTY) {
// e.g. argument lists of MethodInvocation, ClassInstanceCreation, dimensions of ArrayCreation
// ...
return false;
}
if (locationInParent == VariableDeclarationFragment.INITIALIZER_PROPERTY
|| locationInParent == SingleVariableDeclaration.INITIALIZER_PROPERTY
|| locationInParent == ReturnStatement.EXPRESSION_PROPERTY
|| locationInParent == EnhancedForStatement.EXPRESSION_PROPERTY
|| locationInParent == ForStatement.EXPRESSION_PROPERTY
|| locationInParent == WhileStatement.EXPRESSION_PROPERTY
|| locationInParent == DoStatement.EXPRESSION_PROPERTY
|| locationInParent == AssertStatement.EXPRESSION_PROPERTY
|| locationInParent == AssertStatement.MESSAGE_PROPERTY
|| locationInParent == IfStatement.EXPRESSION_PROPERTY
|| locationInParent == SwitchStatement.EXPRESSION_PROPERTY
|| locationInParent == SwitchCase.EXPRESSION_PROPERTY
|| locationInParent == ArrayAccess.INDEX_PROPERTY
|| locationInParent == ThrowStatement.EXPRESSION_PROPERTY
|| locationInParent == SynchronizedStatement.EXPRESSION_PROPERTY
|| locationInParent == ParenthesizedExpression.EXPRESSION_PROPERTY) {
return false;
}
return true;
}
示例3: endVisit
import org.eclipse.jdt.core.dom.ThrowStatement; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public void endVisit(ClassInstanceCreation instanceCreation) {
if (instanceCreation.getParent() instanceof ThrowStatement) {
logger.warn("Ignoring throw statements!");
return;
}
List<?> paramTypes = Arrays.asList(instanceCreation.resolveConstructorBinding().getParameterTypes());
List<?> paramValues = instanceCreation.arguments();
Constructor<?> constructor = retrieveConstructor(instanceCreation.getType(),
paramTypes, paramValues);
List<VariableReference> params = convertParams(instanceCreation.arguments(),
paramTypes);
VariableReference retVal = retrieveVariableReference(instanceCreation, null);
retVal.setOriginalCode(instanceCreation.toString());
ConstructorStatement statement = new ValidConstructorStatement(
testCase.getReference(), constructor, retVal, params);
testCase.addStatement(statement);
}
示例4: endVisit
import org.eclipse.jdt.core.dom.ThrowStatement; //导入依赖的package包/类
@Override
public void endVisit(ThrowStatement node) {
if (skipNode(node)) {
return;
}
ThrowFlowInfo info = createThrow();
setFlowInfo(node, info);
Expression expression = node.getExpression();
info.merge(getFlowInfo(expression), fFlowContext);
}
示例5: visit
import org.eclipse.jdt.core.dom.ThrowStatement; //导入依赖的package包/类
@Override
public boolean visit(ThrowStatement node) {
ITypeBinding exception = node.getExpression().resolveTypeBinding();
if (exception == null) {
return true;
}
addException(exception, node.getAST());
return true;
}
示例6: visit
import org.eclipse.jdt.core.dom.ThrowStatement; //导入依赖的package包/类
@Override
public boolean visit(ThrowStatement node) {
ITypeBinding exception = node.getExpression().resolveTypeBinding();
if (!isSelected(node) || exception == null || Bindings.isRuntimeException(exception)) {
return true;
}
addException(exception, node.getAST());
return true;
}
示例7: visit
import org.eclipse.jdt.core.dom.ThrowStatement; //导入依赖的package包/类
@Override
public boolean visit(ThrowStatement node) {
ITypeBinding exception = node.getExpression().resolveTypeBinding();
if (exception == null) // Safety net for null bindings when compiling fails.
return true;
addException(exception, node.getAST());
return true;
}
示例8: create
import org.eclipse.jdt.core.dom.ThrowStatement; //导入依赖的package包/类
@Override
public ITypeConstraint[] create(ThrowStatement node) {
ConstraintVariable nameVariable =
fConstraintVariableFactory.makeExpressionOrTypeVariable(node.getExpression(), getContext());
ITypeBinding throwable =
node.getAST().resolveWellKnownType("java.lang.Throwable"); // $NON-NLS-1$
return fTypeConstraintFactory.createSubtypeConstraint(
nameVariable, fConstraintVariableFactory.makeRawBindingVariable(throwable));
}
示例9: visit
import org.eclipse.jdt.core.dom.ThrowStatement; //导入依赖的package包/类
@Override
public boolean visit(ThrowStatement node) {
ITypeBinding exception = node.getExpression().resolveTypeBinding();
if (!isSelected(node)
|| exception == null
|| Bindings.isRuntimeException(
exception)) // Safety net for null bindings when compiling fails.
return true;
addException(exception, node.getAST());
return true;
}
示例10: visit
import org.eclipse.jdt.core.dom.ThrowStatement; //导入依赖的package包/类
@Override
public boolean visit(ThrowStatement node) {
ITypeBinding thrownExceptionType = node.getExpression().resolveTypeBinding();
try {
handleException(node, thrownExceptionType);
} catch (JavaModelException e) {
throw new RuntimeException(e);
}
return super.visit(node);
}
开发者ID:mdarefin,项目名称:Convert-For-Each-Loop-to-Lambda-Expression-Eclipse-Plugin,代码行数:12,代码来源:EnhancedForStatementVisitor.java
示例11: visit
import org.eclipse.jdt.core.dom.ThrowStatement; //导入依赖的package包/类
@Override
public boolean visit(ThrowStatement node) {
ITypeBinding binding = node.getExpression().resolveTypeBinding();
if (binding != null) {
ThrownException thrownException = new ThrownException();
Type thrownType = importer.ensureTypeFromTypeBinding(binding);
thrownException.setExceptionClass((com.feenk.jdt2famix.model.famix.Class) thrownType);
thrownException.setDefiningMethod((Method) importer.topOfContainerStack());
importer.repository().add(thrownException);
}
return true;
}
示例12: endVisit
import org.eclipse.jdt.core.dom.ThrowStatement; //导入依赖的package包/类
@Override
public void endVisit(ThrowStatement node) {
if (skipNode(node))
return;
ThrowFlowInfo info= createThrow();
setFlowInfo(node, info);
Expression expression= node.getExpression();
info.merge(getFlowInfo(expression), fFlowContext);
}
示例13: visit
import org.eclipse.jdt.core.dom.ThrowStatement; //导入依赖的package包/类
@Override
public boolean visit(ThrowStatement node) {
ITypeBinding exception= node.getExpression().resolveTypeBinding();
if (exception == null) // Safety net for null bindings when compiling fails.
return true;
addException(exception, node.getAST());
return true;
}
示例14: create
import org.eclipse.jdt.core.dom.ThrowStatement; //导入依赖的package包/类
@Override
public ITypeConstraint[] create(ThrowStatement node) {
ConstraintVariable nameVariable= fConstraintVariableFactory.makeExpressionOrTypeVariable(node.getExpression(), getContext());
ITypeBinding throwable= node.getAST().resolveWellKnownType("java.lang.Throwable"); //$NON-NLS-1$
return fTypeConstraintFactory.createSubtypeConstraint(
nameVariable,
fConstraintVariableFactory.makeRawBindingVariable(throwable));
}
示例15: visit
import org.eclipse.jdt.core.dom.ThrowStatement; //导入依赖的package包/类
@Override
public boolean visit(ThrowStatement node) {
ITypeBinding exception= node.getExpression().resolveTypeBinding();
if (!isSelected(node) || exception == null || Bindings.isRuntimeException(exception)) // Safety net for null bindings when compiling fails.
return true;
addException(exception, node.getAST());
return true;
}