&& (upperBound == null || !upperBound.getJavaClass().isFinal() && !upperBound.getMethod().isFinal()) && !receiverTypeIsExact;
superClinitCall(); if (!method.isStatic() && !method.isPrivate() && !method.isFinal() && !constructor && subtypes != null) { for (ClassDescriptor subtype : subtypes) { try {
@Override public void visit(Code obj) { sawSuperFinalize = false; super.visit(obj); bugAccumulator.reportAccumulatedBugs(); if (!"finalize".equals(getMethodName()) || !"()V".equals(getMethodSig())) { return; } String overridesFinalizeIn = Lookup.findSuperImplementor(getDottedClassName(), "finalize", "()V", bugReporter); boolean superHasNoFinalizer = "java.lang.Object".equals(overridesFinalizeIn); // System.out.println("superclass: " + superclassName); if (obj.getCode().length == 1) { if (superHasNoFinalizer) { if (!getMethod().isFinal()) { bugReporter.reportBug(new BugInstance(this, "FI_EMPTY", NORMAL_PRIORITY).addClassAndMethod(this)); } } else { bugReporter.reportBug(new BugInstance(this, "FI_NULLIFY_SUPER", NORMAL_PRIORITY).addClassAndMethod(this) .addClass(overridesFinalizeIn)); } } else if (obj.getCode().length == 5 && sawSuperFinalize) { bugReporter.reportBug(new BugInstance(this, "FI_USELESS", NORMAL_PRIORITY).addClassAndMethod(this)); } else if (!sawSuperFinalize && !superHasNoFinalizer) { bugReporter.reportBug(new BugInstance(this, "FI_MISSING_SUPER_CALL", NORMAL_PRIORITY).addClassAndMethod(this) .addClass(overridesFinalizeIn)); } }
@Nullable private Deque<SourceLineAnnotation> foundPrivateInChain(Method m, Set<Method> checkedMethods) { Map<Method, SourceLineAnnotation> calledMethods = methodToCalledMethods.get(m); if (calledMethods != null) { for (Map.Entry<Method, SourceLineAnnotation> entry : calledMethods.entrySet()) { Method cm = entry.getKey(); if (checkedMethods.contains(cm)) { continue; } if (!cm.isPrivate() && !cm.isFinal()) { Deque<SourceLineAnnotation> slas = new ArrayDeque<>(); slas.addLast(entry.getValue()); return slas; } checkedMethods.add(cm); Deque<SourceLineAnnotation> slas = foundPrivateInChain(cm, checkedMethods); if (slas != null) { slas.addFirst(entry.getValue()); return slas; } } } return null; } }
@Nullable private Deque<SourceLineAnnotation> foundNonPrivateNonFinalInChain(Method m, Set<Method> checkedMethods) { Map<Method, SourceLineAnnotation> calledMethods = methodToCalledMethods.get(m); if (calledMethods != null) { for (Map.Entry<Method, SourceLineAnnotation> entry : calledMethods.entrySet()) { Method cm = entry.getKey(); if (checkedMethods.contains(cm)) { continue; } if (!cm.isPrivate() && !cm.isFinal()) { Deque<SourceLineAnnotation> slas = new ArrayDeque<>(); slas.addLast(entry.getValue()); return slas; } checkedMethods.add(cm); Deque<SourceLineAnnotation> slas = foundNonPrivateNonFinalInChain(cm, checkedMethods); if (slas != null) { slas.addFirst(entry.getValue()); return slas; } } } return null; } }
meth.isFinal = methList[i].isFinal();
if (methods[i].isFinal()){ throw new ClassConstraintException("Method '"+name_and_sig+"' in class '"+hashmap.get(name_and_sig)+"' overrides the final (not-overridable) definition in class '"+jc.getClassName()+"'.");
public boolean isLoader(ClassGen cg) { return cg.getMethods().length == 3 && cg.getMethods()[1].isStatic() && cg.getMethods()[1].isFinal() && cg.getMethods()[1].isPublic() && cg.getMethods()[1].isSynchronized() && cg.getMethods()[1].getReturnType().toString().equals("java.lang.String"); }
if (method.isFinal()) { if (!(method.isPrivate())) { throw new ClassConstraintException("Method '" + nameAndSig + "' in class '" + hashmap.get(nameAndSig) +
&& (upperBound == null || !upperBound.getJavaClass().isFinal() && !upperBound.getMethod().isFinal()) && !receiverTypeIsExact;
superClinitCall(); if (!method.isStatic() && !method.isPrivate() && !method.isFinal() && !constructor && subtypes != null) { for (ClassDescriptor subtype : subtypes) { try {
@Override public void visit(Code obj) { sawSuperFinalize = false; super.visit(obj); bugAccumulator.reportAccumulatedBugs(); if (!"finalize".equals(getMethodName()) || !"()V".equals(getMethodSig())) { return; } String overridesFinalizeIn = Lookup.findSuperImplementor(getDottedClassName(), "finalize", "()V", bugReporter); boolean superHasNoFinalizer = "java.lang.Object".equals(overridesFinalizeIn); // System.out.println("superclass: " + superclassName); if (obj.getCode().length == 1) { if (superHasNoFinalizer) { if (!getMethod().isFinal()) { bugReporter.reportBug(new BugInstance(this, "FI_EMPTY", NORMAL_PRIORITY).addClassAndMethod(this)); } } else { bugReporter.reportBug(new BugInstance(this, "FI_NULLIFY_SUPER", NORMAL_PRIORITY).addClassAndMethod(this) .addClass(overridesFinalizeIn)); } } else if (obj.getCode().length == 5 && sawSuperFinalize) { bugReporter.reportBug(new BugInstance(this, "FI_USELESS", NORMAL_PRIORITY).addClassAndMethod(this)); } else if (!sawSuperFinalize && !superHasNoFinalizer) { bugReporter.reportBug(new BugInstance(this, "FI_MISSING_SUPER_CALL", NORMAL_PRIORITY).addClassAndMethod(this) .addClass(overridesFinalizeIn)); } }
if (cls != null) { Method m = findMethod(cls, getNameConstantOperand(), getSigConstantOperand()); if ((m != null) && (!m.isFinal())) { if (isCtor && (seen != INVOKESPECIAL)) { bugReporter.reportBug(new BugInstance(this, BugType.PCOA_PARTIALLY_CONSTRUCTED_OBJECT_ACCESS.name(), NORMAL_PRIORITY)
Method m = findMethod(cls, getNameConstantOperand(), getSigConstantOperand()); if (m != null) { if (isCtor && (seen != Const.INVOKESPECIAL) && !m.isFinal()) { bugReporter.reportBug(new BugInstance(this, BugType.PCOA_PARTIALLY_CONSTRUCTED_OBJECT_ACCESS.name(), NORMAL_PRIORITY) .addClass(this).addMethod(this).addSourceLine(this, getPC()));
if (classIsFinal || classIsAnonymous || method.isStatic() || method.isPrivate() || method.isFinal() || ((Values.CONSTRUCTOR.equals(method.getName()) && !isAnonymousInnerCtor(method, getThisClass())))) { String[] exNames = et.getExceptionNames();
if (classIsFinal || classIsAnonymous || method.isStatic() || method.isPrivate() || method.isFinal() || ((Values.CONSTRUCTOR.equals(method.getName()) && !isAnonymousInnerCtor(method, getThisClass())))) { String[] exNames = et.getExceptionNames();
if (obj.isFinal()) { throw new ClassConstraintException( "Abstract method '"+tostring(obj)+"' must not have the ACC_FINAL modifier set."); obj.isFinal() || obj.isSynchronized() || obj.isNative() || || obj.isFinal() || obj.isSynchronized() || obj.isNative()) { || obj.isProtected() || obj.isStatic() || obj.isFinal() || obj.isSynchronized() || obj.isNative()
if (obj.isFinal()) throw new ClassConstraintException("Abstract method '"+tostring(obj)+"' must not have the ACC_FINAL modifier set."); if (obj.isNative()) throw new ClassConstraintException("Abstract method '"+tostring(obj)+"' must not have the ACC_NATIVE modifier set."); if (obj.isPrivate()) throw new ClassConstraintException("Abstract method '"+tostring(obj)+"' must not have the ACC_PRIVATE modifier set."); obj.isProtected() || obj.isStatic() || obj.isFinal() || obj.isSynchronized() || obj.isNative() || obj.isFinal() || obj.isSynchronized() || obj.isNative() ||