List of usage examples for org.eclipse.jdt.internal.compiler.lookup TypeConstants EQUALS
null EQUALS
To view the source code for org.eclipse.jdt.internal.compiler.lookup TypeConstants EQUALS.
Click Source Link
From source file:org.eclipse.objectteams.otdt.internal.core.compiler.control.Dependencies.java
License:Open Source License
private static void checkMissingMethods(ReferenceBinding roleBinding, TypeDeclaration roleDecl) { if (roleBinding.isClass() && ((roleBinding.tagBits & TagBits.AnnotationInstantiation) != 0)) { InstantiationPolicy instantiationPolicy = RoleModel.getInstantiationPolicy(roleBinding); if (!instantiationPolicy.isAlways()) return; ClassScope scope = roleDecl.scope; boolean missing = false; MethodBinding equals = roleBinding.getExactMethod(TypeConstants.EQUALS, new TypeBinding[] { scope.getJavaLangObject() }, scope.compilationUnitScope()); if (equals == null || !equals.isValidBinding() || TypeBinding.notEquals(equals.declaringClass, roleBinding)) { missing = true;// w w w . ja v a 2 s .c o m } else { MethodBinding hashCode = roleBinding.getExactMethod(TypeConstants.HASHCODE, Binding.NO_PARAMETERS, scope.compilationUnitScope()); if (hashCode == null || !hashCode.isValidBinding() || TypeBinding.notEquals(hashCode.declaringClass, roleBinding)) missing = true; } if (missing) { scope.problemReporter().missingEqualsHashCodeWithInstantation(scope.referenceContext, instantiationPolicy); } } // copied abstract methods are not yet checked for callout inference (which is normally triggered from checkMethods()) if (roleBinding.isClass() && roleDecl.methods != null) { for (AbstractMethodDeclaration method : roleDecl.methods) { if (((method.modifiers & ClassFileConstants.AccAbstract) != 0) && method.isCopied) { // inheriting abstract method in non-abstract role may require callout inference: CalloutImplementor coi = new CalloutImplementor(roleDecl.getRoleModel()); MethodDeclaration callout = coi.generateInferredCallout(roleDecl, method.binding); if (callout != null) roleDecl.scope.problemReporter().addingInferredCalloutForInherited(roleDecl, method.binding, callout); } } } }