Giter VIP home page Giter VIP logo

Comments (12)

lukaszlenart avatar lukaszlenart commented on August 12, 2024

It can be only related to #19

from ognl.

marvkis avatar marvkis commented on August 12, 2024

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...

from ognl.

lukaszlenart avatar lukaszlenart commented on August 12, 2024

@marvkis great, thanks a lot!

from ognl.

marvkis avatar marvkis commented on August 12, 2024

Okay, I have an idea what's going wrong:
Initially in AstMethod.getChildrenClasses() implementation for ASTList I already had a parametrized array as returning type that hold's the information about the appropriate carried class types. But as this didn't reflect ASTList's real behavior - returning an ArrayList - this wasn't the right way so I changed it to return a list. List itself is a generic type, but as far as I know a 'Class' can't be parametrized easily so the 'inner' type information got lost and so the method weighting can't make a clean decision...

Have to dig into that... but it must work somehow, when refactoring into a class the returning types are parametrized...

from ognl.

marvkis avatar marvkis commented on August 12, 2024

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 avg() with a java.util.List argument? And indeed, it chooses the avg(Iterable...) method.

And it didn't work because the OgnlRuntime.isTypeCompatible() bailed out with an exception to early instead of continuing if there is a better matching method.
I also had to change the method weighting and matching a bit with the 'Generics Type Erasure' in mind: A java.util.List only will match to an Object[] array during runtime. With this in mind all Unit-Tests worked again.

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 ;)

from ognl.

lukaszlenart avatar lukaszlenart commented on August 12, 2024

@marvkis aka sa-ChristianNiessner please provide your company name and I will used in Version Notes :)

from ognl.

marvin-enthus avatar marvin-enthus commented on August 12, 2024

@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!

from ognl.

danielfernandez avatar danielfernandez commented on August 12, 2024

Do we already have a snapshot for this? if so, what's OGNL's Maven snapshots repository?

from ognl.

lukaszlenart avatar lukaszlenart commented on August 12, 2024

@danielfernandez just pushed it to https://oss.sonatype.org/content/repositories/snapshots/

from ognl.

danielfernandez avatar danielfernandez commented on August 12, 2024

I can confirm all Thymeleaf tests pass with 3.1.5-SNAPSHOT, including the dozen tests that fail with 3.1.4

from ognl.

lukaszlenart avatar lukaszlenart commented on August 12, 2024

Fixed with #24

from ognl.

lukaszlenart avatar lukaszlenart commented on August 12, 2024

3.1.5 is under way to the Central, thanks @sa-ChristianNiessner and @danielfernandez !

from ognl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.