Browse Source
Although the Spring Expression Language (SpEL) generally does a good job of locating the public declaring class or interface on which to invoke a method in a compiled expression, prior to this commit there were still a few unsupported use cases. To address those remaining use cases, this commit ensures that methods are invoked via a public interface or public superclass whenever possible when compiling SpEL expressions. See gh-29857pull/32397/head
7 changed files with 357 additions and 58 deletions
@ -0,0 +1,26 @@
@@ -0,0 +1,26 @@
|
||||
/* |
||||
* Copyright 2002-2024 the original author or authors. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
package org.springframework.expression.spel; |
||||
|
||||
/** |
||||
* This is intentionally a top-level public interface. |
||||
*/ |
||||
public interface PublicInterface { |
||||
|
||||
String getText(); |
||||
|
||||
} |
||||
@ -0,0 +1,40 @@
@@ -0,0 +1,40 @@
|
||||
/* |
||||
* Copyright 2002-2024 the original author or authors. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
package org.springframework.expression.spel; |
||||
|
||||
/** |
||||
* This is intentionally a top-level public class. |
||||
*/ |
||||
public class PublicSuperclass { |
||||
|
||||
public int process(int num) { |
||||
return num + 1; |
||||
} |
||||
|
||||
public int getNumber() { |
||||
return 1; |
||||
} |
||||
|
||||
public String getMessage() { |
||||
return "goodbye"; |
||||
} |
||||
|
||||
public String greet(String name) { |
||||
return "Super, " + name; |
||||
} |
||||
|
||||
} |
||||
Loading…
Reference in new issue