-
-
Notifications
You must be signed in to change notification settings - Fork 80
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
Exception selecting overloaded method in 3.1.4 #23
Comments
It can be only related to #19 |
Hi. #19 was originally made by me. I'll take a look into that issue... Sorry for the late reply it seems somehow my github email notification's dont work and I just disovered this by chance... |
@marvkis great, thanks a lot! |
Okay, I have an idea what's going wrong: Have to dig into that... but it must work somehow, when refactoring into a class the returning types are parametrized... |
….1.4 - Improved method matching: Lists default to List<Object> because of "Java Generics Type Erasure" - Don't bail out (with exception) immedeately if we get two methods with same score - a method with a better score might follow. Just remember the Exception and if we really don't get an better option throw the exception
….1.4 - Improved method matching: Lists default to List<Object> because of "Java Generics Type Erasure" - Don't bail out (with exception) immedeately if we get two methods with same score - a method with a better score might follow. Just remember the Exception and if we really don't get an better option throw the exception
After some investigation: The "Generics" approach is the wrong way. I started an approach to use a "typed class carrier" but it was the wrong way. It worked quite well for "compiled" OGNL commands, but it failed during interpretation - Interpretation is done on live objects and not on classes, and due to "Generics Type Erasure" generics type information is only available during compilation and not any more during run time. So i abandoned this approach - it's still here for whom it might interest: Issue-23-Generics So, as always if you ran into the wrong direction, change your perspective: What does java itself when it has to call And it didn't work because the Btw: sa-ChristianNiessner is my 'work' account and marvkis my personal / private account. I did this during work hours so the credit is for my company ;) |
@marvkis aka |
@lukaszlenart it is 'secadm GmbH' - http://www.secadm.de/ . thanks a lot. @danielfernandez Was this discovered in an unit test of thymeleaf or during runtime? Can you do further 'real life' tests? @lukaszlenart can you test it within struts to see if the changes perform fine or bring up another issues? thanks! |
Do we already have a snapshot for this? if so, what's OGNL's Maven snapshots repository? |
@danielfernandez just pushed it to https://oss.sonatype.org/content/repositories/snapshots/ |
I can confirm all Thymeleaf tests pass with |
Fixed with #24 |
3.1.5 is under way to the Central, thanks @sa-ChristianNiessner and @danielfernandez ! |
In Thymeleaf there is an
Aggregates
class which contains an overloadedavg(...)
method. See the specific class here.All the different variants of this method look like this:
In one of my tests, I create an object using an OGNL expression, like:
Which creates a
java.util.ArrayList<java.lang.Integer>
for thenums01
variable.Then I use this variable as an argument to an
avg
call in an OGNL expression such as:This worked perfectly until OGNL 3.1.3, and the first version of the overloaded method (the one receiving an
Iterable<? extends Number>
) was executed. However, in OGNL 3.1.4 I receive this exception:The text was updated successfully, but these errors were encountered: