Skip to content

OGNL-102 Improves performance when null was returned#204

Merged
lukaszlenart merged 7 commits intomasterfrom
OGNL-102-performance
Aug 23, 2023
Merged

OGNL-102 Improves performance when null was returned#204
lukaszlenart merged 7 commits intomasterfrom
OGNL-102-performance

Conversation

@lukaszlenart
Copy link
Copy Markdown
Collaborator

@lukaszlenart lukaszlenart commented Apr 11, 2023

This PR introduces options to short-circuit chain operations on null result in case if accessing property of the object, eg. obj1.property where obj1 is null or obj1.obj2.property where obj2 is null.

This functionality is enabled by default, use -Dognl.chain.short-circuit=false to disable it.

Refs #140
Refs OGNL-102

@lukaszlenart lukaszlenart added this to the OGNL 3.4.0 milestone Apr 11, 2023
@lukaszlenart lukaszlenart force-pushed the OGNL-102-performance branch 2 times, most recently from 3c76136 to e4cd96a Compare May 18, 2023 06:00
@sonarqubecloud
Copy link
Copy Markdown

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@lukaszlenart lukaszlenart marked this pull request as ready for review May 18, 2023 06:23
@lukaszlenart lukaszlenart marked this pull request as draft May 18, 2023 06:30
@lukaszlenart lukaszlenart force-pushed the OGNL-102-performance branch from e4cd96a to f17a24c Compare July 25, 2023 06:30
@lukaszlenart lukaszlenart force-pushed the OGNL-102-performance branch from ad0a395 to 46079a1 Compare July 26, 2023 18:55
@lukaszlenart
Copy link
Copy Markdown
Collaborator Author

@davoustp @harawata @quaff could you take a look? This is another approach to improve performance, it's in relation to #138 and the JIRA ticket. @harawata I have added your test cases from #140 and they passed.

@lukaszlenart lukaszlenart marked this pull request as ready for review July 26, 2023 18:56
@sonarqubecloud
Copy link
Copy Markdown

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell D 2 Code Smells

88.2% 88.2% Coverage
0.0% 0.0% Duplication

warning The version of Java (11.0.20) you have used to run this analysis is deprecated and we will stop accepting it soon. Please update to at least Java 17.
Read more here

idea Catch issues before they fail your Quality Gate with our IDE extension sonarlint SonarLint

@lukaszlenart lukaszlenart merged commit ab5298b into master Aug 23, 2023
@lukaszlenart lukaszlenart deleted the OGNL-102-performance branch August 23, 2023 05:20
lukaszlenart added a commit that referenced this pull request Nov 1, 2025
…ervation in lambda expressions

This commit reverts changes introduced in PR #204 (short-circuit optimization) to fix Issue #472
where lambda expressions in list operations could not access root context properties.

Changes:
- Removed addDefaultContext() wrapper in Ognl.getValue() that was overwriting context root
- Removed short-circuit optimization logic from ASTChain.getValueBody()
- Reverted to pre-PR #204 behavior: null property access now throws OgnlException
- Updated ChainTest and NullRootTest to expect exceptions instead of null returns
- Added comprehensive Issue472CustomMethodAccessorTest with 5 test cases

The revert simplifies the codebase and ensures context root preservation throughout
nested evaluations, allowing #root references to work correctly in lambda expressions.

Fixes #472

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
lukaszlenart added a commit that referenced this pull request Nov 1, 2025
…ervation in lambda expressions (#476)

This commit reverts changes introduced in PR #204 (short-circuit optimization) to fix Issue #472
where lambda expressions in list operations could not access root context properties.

Changes:
- Removed addDefaultContext() wrapper in Ognl.getValue() that was overwriting context root
- Removed short-circuit optimization logic from ASTChain.getValueBody()
- Reverted to pre-PR #204 behavior: null property access now throws OgnlException
- Updated ChainTest and NullRootTest to expect exceptions instead of null returns
- Added comprehensive Issue472CustomMethodAccessorTest with 5 test cases

The revert simplifies the codebase and ensures context root preservation throughout
nested evaluations, allowing #root references to work correctly in lambda expressions.

Fixes #472

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <[email protected]>
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

Successfully merging this pull request may close these issues.

1 participant