Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Violation of the LSP principle #20

Open
carana08 opened this issue Jun 23, 2023 · 0 comments
Open

Violation of the LSP principle #20

carana08 opened this issue Jun 23, 2023 · 0 comments

Comments

@carana08
Copy link

Liskov Substitution Principle
In this class, the principle is violated:

package org.orienteer.oposter.ok;
import com.github.scribejava.apis.OdnoklassnikiApi;
import com.github.scribejava.apis.odnoklassniki.OdnoklassnikiOAuthService;
import com.github.scribejava.core.httpclient.HttpClient;
import com.github.scribejava.core.httpclient.HttpClientConfig;
/**
* Temporal solution while https://github.com/scribejava/scribejava/pull/998 is awaiting to be merged
*/
public class FixedOdnoklassnikiApi extends OdnoklassnikiApi {
private static class InstanceHolder {
private static final FixedOdnoklassnikiApi INSTANCE = new FixedOdnoklassnikiApi();
}
public static FixedOdnoklassnikiApi instance() {
return InstanceHolder.INSTANCE;
}
@Override
public OdnoklassnikiOAuthService createService(String apiKey, String apiSecret, String callback,
String defaultScope, String responseType, String userAgent, HttpClientConfig httpClientConfig,
HttpClient httpClient) {
return new FixedOdnoklassnikiOAuthService(this, apiKey, apiSecret, callback, defaultScope, responseType, userAgent,
httpClientConfig, httpClient);
}
}

Maybe it could be solved like this
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant