本文整理汇总了Java中org.eclipse.jdt.internal.compiler.lookup.MethodBinding.isMain方法的典型用法代码示例。如果您正苦于以下问题:Java MethodBinding.isMain方法的具体用法?Java MethodBinding.isMain怎么用?Java MethodBinding.isMain使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.internal.compiler.lookup.MethodBinding
的用法示例。
在下文中一共展示了MethodBinding.isMain方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: reportOnlyUselesslyReadLocal
import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; //导入方法依赖的package包/类
static void reportOnlyUselesslyReadLocal(BlockScope currentScope, LocalVariableBinding localBinding, boolean valueRequired) {
if (localBinding.declaration == null)
return; // secret local
if ((localBinding.declaration.bits & ASTNode.IsLocalDeclarationReachable) == 0)
return; // declaration is unreachable
if (localBinding.useFlag >= LocalVariableBinding.USED)
return; // we're only interested in cases with only compound access (negative count)
if (valueRequired) {
// access is relevant
localBinding.useFlag = LocalVariableBinding.USED;
return;
} else {
localBinding.useFlag++;
if (localBinding.useFlag != LocalVariableBinding.UNUSED) // have all negative counts been consumed?
return; // still waiting to see more usages of this kind
}
// at this point we know we have something to report
if (localBinding.declaration instanceof Argument) {
// check compiler options to report against unused arguments
MethodScope methodScope = currentScope.methodScope();
if (methodScope != null && !methodScope.isLambdaScope()) { // lambda must be congruent with the descriptor.
MethodBinding method = ((AbstractMethodDeclaration)methodScope.referenceContext()).binding;
boolean shouldReport = !method.isMain();
if (method.isImplementing()) {
shouldReport &= currentScope.compilerOptions().reportUnusedParameterWhenImplementingAbstract;
} else if (method.isOverriding()) {
shouldReport &= currentScope.compilerOptions().reportUnusedParameterWhenOverridingConcrete;
}
if (shouldReport) {
// report the case of an argument that is unread except through a special operator
currentScope.problemReporter().unusedArgument(localBinding.declaration);
}
}
} else {
// report the case of a local variable that is unread except for a special operator
currentScope.problemReporter().unusedLocalVariable(localBinding.declaration);
}
localBinding.useFlag = LocalVariableBinding.USED; // don't report again
}
示例2: reportOnlyUselesslyReadLocal
import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; //导入方法依赖的package包/类
static void reportOnlyUselesslyReadLocal(BlockScope currentScope, LocalVariableBinding localBinding, boolean valueRequired) {
if (localBinding.declaration == null)
return; // secret local
if ((localBinding.declaration.bits & ASTNode.IsLocalDeclarationReachable) == 0)
return; // declaration is unreachable
if (localBinding.useFlag >= LocalVariableBinding.USED)
return; // we're only interested in cases with only compound access (negative count)
if (valueRequired) {
// access is relevant
localBinding.useFlag = LocalVariableBinding.USED;
return;
} else {
localBinding.useFlag++;
if (localBinding.useFlag != LocalVariableBinding.UNUSED) // have all negative counts been consumed?
return; // still waiting to see more usages of this kind
}
// at this point we know we have something to report
if (localBinding.declaration instanceof Argument) {
// check compiler options to report against unused arguments
MethodScope methodScope = currentScope.methodScope();
if (methodScope != null) {
MethodBinding method = ((AbstractMethodDeclaration)methodScope.referenceContext()).binding;
boolean shouldReport = !method.isMain();
if (method.isImplementing()) {
shouldReport &= currentScope.compilerOptions().reportUnusedParameterWhenImplementingAbstract;
} else if (method.isOverriding()) {
shouldReport &= currentScope.compilerOptions().reportUnusedParameterWhenOverridingConcrete;
}
if (shouldReport) {
// report the case of an argument that is unread except through a special operator
currentScope.problemReporter().unusedArgument(localBinding.declaration);
}
}
} else {
// report the case of a local variable that is unread except for a special operator
currentScope.problemReporter().unusedLocalVariable(localBinding.declaration);
}
localBinding.useFlag = LocalVariableBinding.USED; // don't report again
}