Code review comment: I think you are right (about the last thing). Fixed.

Code under review:
private boolean changesAvailable(Application application, JobStatus previous, JobStatus next) {
        if ( ! application.deploying().isPresent()) return false;

        Change change = application.deploying().get();

        if (change instanceof Change.VersionChange) { 
            Version targetVersion = ((Change.VersionChange)change).version();

            
            if ( ! lastSuccessfulIs(targetVersion, JobType.stagingTest, application))
                return false;

            
            if ( previous.type().isProduction() && ! isOnAtLeastProductionVersion(targetVersion, application, previous.type()))
                return false;

            
            if (next != null && next.type().isTest() && lastSuccessfulIs(targetVersion, next.type(), application))
                return false;

            
            if (next != null && next.type().isProduction() && isOnAtLeastProductionVersion(targetVersion, application, next.type()))
                return false;

            return true;
        }
        else { 
            if ( ! previous.lastSuccess().isPresent()) return false;
            if (next == null) return true;
            if ( ! next.lastSuccess().isPresent()) return true;
            return previous.lastSuccess().get().revision().isPresent() &&
                   ! previous.lastSuccess().get().revision().equals(next.lastSuccess().get().revision());
        }
    }

Line commented on: return false;

Revised code:
private boolean changesAvailable(Application application, JobStatus previous, JobStatus next) {
        if ( ! application.deploying().isPresent()) return false;
        if (next == null) return true;

        Change change = application.deploying().get();

        if (change instanceof Change.VersionChange) { 
            Version targetVersion = ((Change.VersionChange)change).version();

            if (next.type().isTest()) {
                
                if ( ! lastSuccessfulIs(targetVersion, previous.type(), application))
                    return false;

                
                if (lastSuccessfulIs(targetVersion, next.type(), application))
                    return false;
            }
            else if (next.type().isProduction()) {
                
                if ( ! lastSuccessfulIs(targetVersion, JobType.stagingTest, application))
                    return false;

                
                if (previous.type().isProduction() && ! alreadyDeployed(targetVersion, application, previous.type()))
                    return false;

                
                if (alreadyDeployed(targetVersion, application, next.type()))
                    return false;
            }
            else
                throw new IllegalStateException("Unclassified type of next job: " + next);

            return true;
        }
        else { 
            if ( ! previous.lastSuccess().isPresent()) return false;
            if ( ! next.lastSuccess().isPresent()) return true;
            return previous.lastSuccess().get().revision().isPresent() &&
                   ! previous.lastSuccess().get().revision().equals(next.lastSuccess().get().revision());
        }
    }