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

StandardInterceptUrlRegistry should not refer to ExpressionUrlAuthorizationConfigurer #9026

Closed
jzheaux opened this issue Sep 16, 2020 · 0 comments
Assignees
Labels
in: config An issue in spring-security-config type: bug A general bug
Milestone

Comments

@jzheaux
Copy link
Contributor

jzheaux commented Sep 16, 2020

Current Behavior

StandardInterceptUrlRegistry is defined in UrlAuthorizationConfigurer:

public class StandardInterceptUrlRegistry
	extends
	ExpressionUrlAuthorizationConfigurer<H>.AbstractInterceptUrlRegistry<StandardInterceptUrlRegistry, AuthorizedUrl> {

ExpressionInterceptUrlRegistry is defined in ExpressionUrlAuthorizationConfigurer

The latter is defined as:

public class ExpressionInterceptUrlRegistry
	extends
	ExpressionUrlAuthorizationConfigurer<H>.AbstractInterceptUrlRegistry<ExpressionInterceptUrlRegistry, AuthorizedUrl> {

Expected Behavior

It's inconsistent that StandardInterceptUrlRegistry refers to AbstractInterceptUrlRegistry through ExpressionUrlAuthorizationConfigurer. Instead, it should refer to it through its own parent class, UrlAuthorizationConfigurer like so:

public class StandardInterceptUrlRegistry
	extends
	UrlAuthorizationConfigurer<H>.AbstractInterceptUrlRegistry<StandardInterceptUrlRegistry, AuthorizedUrl> {

Without this, some JDK 9+ versions refuse to compile as it creates two distinct H type parameters:

/home/jzheaux/dev/spring-projects/spring-security-5.3.x/config/src/main/java/org/springframework/security/config/annotation/web/configurers/UrlAuthorizationConfigurer.java:122: error: type argument UrlAuthorizationConfigurer<H#1>.StandardInterceptUrlRegistry is not within bounds of type-variable R
                        ExpressionUrlAuthorizationConfigurer<H>.AbstractInterceptUrlRegistry<UrlAuthorizationConfigurer<H>.StandardInterceptUrlRegistry, AuthorizedUrl> {
                                                                                                                          ^
  where H#1,R,T,C,H#2 are type-variables:
    H#1 extends HttpSecurityBuilder<H#1> declared in class UrlAuthorizationConfigurer
    R extends AbstractInterceptUrlConfigurer<C,H#2>.AbstractInterceptUrlRegistry<R,T> declared in class AbstractInterceptUrlConfigurer.AbstractInterceptUrlRegistry
    T extends Object declared in class AbstractInterceptUrlConfigurer.AbstractInterceptUrlRegistry
    C extends AbstractInterceptUrlConfigurer<C,H#2> declared in class AbstractInterceptUrlConfigurer
    H#2 extends HttpSecurityBuilder<H#2> declared in class AbstractInterceptUrlConfigurer
/home/jzheaux/dev/spring-projects/spring-security-5.3.x/config/src/main/java/org/springframework/security/config/annotation/web/configurers/UrlAuthorizationConfigurer.java:122: error: improperly formed type, type arguments given on a raw type
                        ExpressionUrlAuthorizationConfigurer<H>.AbstractInterceptUrlRegistry<UrlAuthorizationConfigurer<H>.StandardInterceptUrlRegistry, AuthorizedUrl> {

AbstractInterceptUrlRegistry is declared in a shared parent AbstractInterceptUrlConfigurer. That means that changing extends ExpressionUrlAuthorizationConfigurer<H>.AbstractInterceptUrlRegistry to UrlAuthorizationConfigurer<H>.AbstractInterceptUrlRegistry won't change the inheritance graph and should be binary-compatible.

@jzheaux jzheaux added in: config An issue in spring-security-config type: bug A general bug labels Sep 16, 2020
@jzheaux jzheaux added this to the 5.4.1 milestone Sep 16, 2020
@jzheaux jzheaux self-assigned this Sep 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: config An issue in spring-security-config type: bug A general bug
Projects
None yet
Development

No branches or pull requests

1 participant