本文整理汇总了Java中org.eclipse.jdt.internal.corext.util.JdtFlags.isStatic方法的典型用法代码示例。如果您正苦于以下问题:Java JdtFlags.isStatic方法的具体用法?Java JdtFlags.isStatic怎么用?Java JdtFlags.isStatic使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.internal.corext.util.JdtFlags
的用法示例。
在下文中一共展示了JdtFlags.isStatic方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isExtractSupertypeAvailable
import org.eclipse.jdt.internal.corext.util.JdtFlags; //导入方法依赖的package包/类
public static boolean isExtractSupertypeAvailable(IMember member) throws JavaModelException {
if (!member.exists()) return false;
final int type = member.getElementType();
if (type != IJavaElement.METHOD && type != IJavaElement.FIELD && type != IJavaElement.TYPE)
return false;
if (JdtFlags.isEnum(member) && type != IJavaElement.TYPE) return false;
if (!Checks.isAvailable(member)) return false;
if (member instanceof IMethod) {
final IMethod method = (IMethod) member;
if (method.isConstructor()) return false;
if (JdtFlags.isNative(method)) return false;
member = method.getDeclaringType();
} else if (member instanceof IField) {
member = member.getDeclaringType();
}
if (member instanceof IType) {
if (JdtFlags.isEnum(member) || JdtFlags.isAnnotation(member)) return false;
if (member.getDeclaringType() != null && !JdtFlags.isStatic(member)) return false;
if (((IType) member).isAnonymous())
return false; // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=253727
if (((IType) member).isLambda()) return false;
}
return true;
}
示例2: visit
import org.eclipse.jdt.internal.corext.util.JdtFlags; //导入方法依赖的package包/类
@Override
public boolean visit(MethodInvocation node) {
IMethodBinding binding = node.resolveMethodBinding();
if (binding != null
&& !JdtFlags.isStatic(binding)
&& node.getExpression() == null
&& Bindings.isSuperType(binding.getDeclaringClass(), fFunctionalInterface, false))
throw new AbortSearchException();
return true;
}
示例3: isMoveStaticAvailable
import org.eclipse.jdt.internal.corext.util.JdtFlags; //导入方法依赖的package包/类
public static boolean isMoveStaticAvailable(final IMember member) throws JavaModelException {
if (!member.exists()) return false;
final int type = member.getElementType();
if (type != IJavaElement.METHOD && type != IJavaElement.FIELD && type != IJavaElement.TYPE)
return false;
if (JdtFlags.isEnum(member) && type != IJavaElement.TYPE) return false;
final IType declaring = member.getDeclaringType();
if (declaring == null) return false;
if (!Checks.isAvailable(member)) return false;
if (type == IJavaElement.METHOD && declaring.isInterface()) {
boolean is18OrHigher = JavaModelUtil.is18OrHigher(member.getJavaProject());
if (!is18OrHigher || !Flags.isStatic(member.getFlags())) return false;
}
if (type == IJavaElement.METHOD && !JdtFlags.isStatic(member)) return false;
if (type == IJavaElement.METHOD && ((IMethod) member).isConstructor()) return false;
if (type == IJavaElement.TYPE && !JdtFlags.isStatic(member)) return false;
if (!declaring.isInterface() && !JdtFlags.isStatic(member)) return false;
return true;
}
示例4: isPullUpAvailable
import org.eclipse.jdt.internal.corext.util.JdtFlags; //导入方法依赖的package包/类
public static boolean isPullUpAvailable(IMember member) throws JavaModelException {
if (!member.exists()) return false;
final int type = member.getElementType();
if (type != IJavaElement.METHOD && type != IJavaElement.FIELD && type != IJavaElement.TYPE)
return false;
if (JdtFlags.isEnum(member) && type != IJavaElement.TYPE) return false;
if (!Checks.isAvailable(member)) return false;
if (member instanceof IType) {
if (!JdtFlags.isStatic(member) && !JdtFlags.isEnum(member) && !JdtFlags.isAnnotation(member))
return false;
}
if (member instanceof IMethod) {
final IMethod method = (IMethod) member;
if (method.isConstructor()) return false;
if (JdtFlags.isNative(method)) return false;
final IType declaring = method.getDeclaringType();
if (declaring != null && declaring.isAnnotation()) return false;
}
return true;
}
示例5: isPushDownAvailable
import org.eclipse.jdt.internal.corext.util.JdtFlags; //导入方法依赖的package包/类
public static boolean isPushDownAvailable(final IMember member) throws JavaModelException {
if (!member.exists()) return false;
final int type = member.getElementType();
if (type != IJavaElement.METHOD && type != IJavaElement.FIELD) return false;
if (JdtFlags.isEnum(member)) return false;
if (!Checks.isAvailable(member)) return false;
if (JdtFlags.isStatic(member)) return false;
if (type == IJavaElement.METHOD) {
final IMethod method = (IMethod) member;
if (method.isConstructor()) return false;
if (JdtFlags.isNative(method)) return false;
final IType declaring = method.getDeclaringType();
if (declaring != null && declaring.isAnnotation()) return false;
}
return true;
}
示例6: checkArgName
import org.eclipse.jdt.internal.corext.util.JdtFlags; //导入方法依赖的package包/类
private void checkArgName() {
String fieldName = fField.getElementName();
boolean isStatic = true;
try {
isStatic = JdtFlags.isStatic(fField);
} catch (JavaModelException e) {
JavaPlugin.log(e);
}
if ((isStatic
&& fArgName.equals(fieldName)
&& fieldName.equals(fField.getDeclaringType().getElementName()))
|| JavaConventionsUtil.validateIdentifier(fArgName, fField).getSeverity()
== IStatus.ERROR) {
fArgName = "_" + fArgName; // $NON-NLS-1$
}
}
示例7: addTypeParameters
import org.eclipse.jdt.internal.corext.util.JdtFlags; //导入方法依赖的package包/类
private static void addTypeParameters(final CompilationUnit unit, final IType type, final Map<String, ITypeBinding> map) throws JavaModelException {
Assert.isNotNull(unit);
Assert.isNotNull(type);
Assert.isNotNull(map);
final AbstractTypeDeclaration declaration= ASTNodeSearchUtil.getAbstractTypeDeclarationNode(type, unit);
if (declaration instanceof TypeDeclaration) {
ITypeBinding binding= null;
TypeParameter parameter= null;
for (final Iterator<TypeParameter> iterator= ((TypeDeclaration) declaration).typeParameters().iterator(); iterator.hasNext();) {
parameter= iterator.next();
binding= parameter.resolveBinding();
if (binding != null && !map.containsKey(binding.getKey()))
map.put(binding.getKey(), binding);
}
final IType declaring= type.getDeclaringType();
if (declaring != null && !JdtFlags.isStatic(type))
addTypeParameters(unit, declaring, map);
}
}
示例8: isMoveStaticAvailable
import org.eclipse.jdt.internal.corext.util.JdtFlags; //导入方法依赖的package包/类
public static boolean isMoveStaticAvailable(final IMember member) throws JavaModelException {
if (!member.exists())
return false;
final int type= member.getElementType();
if (type != IJavaElement.METHOD && type != IJavaElement.FIELD && type != IJavaElement.TYPE)
return false;
if (JdtFlags.isEnum(member) && type != IJavaElement.TYPE)
return false;
final IType declaring= member.getDeclaringType();
if (declaring == null)
return false;
if (!Checks.isAvailable(member))
return false;
if (type == IJavaElement.METHOD && declaring.isInterface())
return false;
if (type == IJavaElement.METHOD && !JdtFlags.isStatic(member))
return false;
if (type == IJavaElement.METHOD && ((IMethod) member).isConstructor())
return false;
if (type == IJavaElement.TYPE && !JdtFlags.isStatic(member))
return false;
if (!declaring.isInterface() && !JdtFlags.isStatic(member))
return false;
return true;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:26,代码来源:RefactoringAvailabilityTester.java
示例9: isPushDownAvailable
import org.eclipse.jdt.internal.corext.util.JdtFlags; //导入方法依赖的package包/类
public static boolean isPushDownAvailable(final IMember member) throws JavaModelException {
if (!member.exists())
return false;
final int type= member.getElementType();
if (type != IJavaElement.METHOD && type != IJavaElement.FIELD)
return false;
if (JdtFlags.isEnum(member))
return false;
if (!Checks.isAvailable(member))
return false;
if (JdtFlags.isStatic(member))
return false;
if (type == IJavaElement.METHOD) {
final IMethod method= (IMethod) member;
if (method.isConstructor())
return false;
if (JdtFlags.isNative(method))
return false;
final IType declaring= method.getDeclaringType();
if (declaring != null && declaring.isAnnotation())
return false;
}
return true;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:25,代码来源:RefactoringAvailabilityTester.java
示例10: isVirtual
import org.eclipse.jdt.internal.corext.util.JdtFlags; //导入方法依赖的package包/类
private static boolean isVirtual(IMethod method) throws JavaModelException {
if (method.isConstructor()) {
return false;
}
if (JdtFlags.isPrivate(method)) {
return false;
}
if (JdtFlags.isStatic(method)) {
return false;
}
return true;
}
示例11: isInterfaceMigrationAvailable
import org.eclipse.jdt.internal.corext.util.JdtFlags; //导入方法依赖的package包/类
public static boolean isInterfaceMigrationAvailable(IMethod method, boolean allowConcreteClasses,
Optional<IProgressMonitor> monitor) throws JavaModelException {
if (!Checks.isAvailable(method))
return false;
if (method.isConstructor())
return false;
if (JdtFlags.isNative(method))
return false;
if (JdtFlags.isStatic(method))
return false;
if (JdtFlags.isAbstract(method))
return false;
// TODO: Should this be here?
if (JdtFlags.isSynchronized(method))
return false;
// TODO: Should this be here?
if (JdtFlags.isFinal(method))
return false;
if (method.getResource().isDerived(IResource.CHECK_ANCESTORS))
return false;
final IType declaring = method.getDeclaringType();
if (declaring != null)
if (declaring.isInterface())
return false; // Method is already in an interface
else if (!allowConcreteClasses && !Flags.isAbstract(declaring.getFlags()))
return false; // no concrete types allowed.
// ensure that there is a target method.
IMethod targetMethod = MigrateSkeletalImplementationToInterfaceRefactoringProcessor.getTargetMethod(method,
monitor);
if (targetMethod == null) // no possible target.
return false;
return true;
}
开发者ID:ponder-lab,项目名称:Migrate-Skeletal-Implementation-to-Interface-Refactoring,代码行数:37,代码来源:RefactoringAvailabilityTester.java
示例12: overridesAnotherMethod
import org.eclipse.jdt.internal.corext.util.JdtFlags; //导入方法依赖的package包/类
public static IMethod overridesAnotherMethod(IMethod method, ITypeHierarchy hierarchy)
throws JavaModelException {
MethodOverrideTester tester = new MethodOverrideTester(method.getDeclaringType(), hierarchy);
IMethod found = tester.findDeclaringMethod(method, true);
boolean overrides =
(found != null
&& !found.equals(method)
&& (!JdtFlags.isStatic(found))
&& (!JdtFlags.isPrivate(found)));
if (overrides) return found;
else return null;
}
示例13: isMoveMethodAvailable
import org.eclipse.jdt.internal.corext.util.JdtFlags; //导入方法依赖的package包/类
public static boolean isMoveMethodAvailable(final IMethod method) throws JavaModelException {
return method.exists()
&& !method.isConstructor()
&& !method.isBinary()
&& !method.isReadOnly()
&& !JdtFlags.isStatic(method)
&& (JdtFlags.isDefaultMethod(method) || !method.getDeclaringType().isInterface());
}
示例14: createModifiers
import org.eclipse.jdt.internal.corext.util.JdtFlags; //导入方法依赖的package包/类
private int createModifiers() throws JavaModelException {
int result = 0;
if (Flags.isPublic(fVisibility)) result |= Modifier.PUBLIC;
else if (Flags.isProtected(fVisibility)) result |= Modifier.PROTECTED;
else if (Flags.isPrivate(fVisibility)) result |= Modifier.PRIVATE;
if (JdtFlags.isStatic(fField)) result |= Modifier.STATIC;
return result;
}
示例15: createFieldAccess
import org.eclipse.jdt.internal.corext.util.JdtFlags; //导入方法依赖的package包/类
private String createFieldAccess() throws JavaModelException {
String fieldName = fField.getElementName();
boolean nameConflict = fArgName.equals(fieldName);
if (JdtFlags.isStatic(fField)) {
if (nameConflict) {
return JavaModelUtil.concatenateName(fField.getDeclaringType().getElementName(), fieldName);
}
} else {
if (nameConflict || StubUtility.useThisForFieldAccess(fField.getJavaProject())) {
return "this." + fieldName; // $NON-NLS-1$
}
}
return fieldName;
}