spring-projects / spring-projects/spring-tools

Advanced Validation for Annotations with Spring Expression Language

Open
#520 0 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

theme: spel-support type: enhancement
Dominant language
Java
Stars
983
Forks
240
Avg merge
7d 1h
Merged PRs (30d)
7

Description

Follow up of https://github.com/spring-projects/sts4/issues/475

Considering this situation:

@CacheEvict(key = "#customer.customerId")
public void insert(Customer customer) {
	//some logic
}

Then assume to refactor rename the field customerId of the Customer class to e.g. just id. Since the cache key String literal is not considered by the refactoring action (which is tackled here https://github.com/spring-projects/sts4/issues/521) it is hard to notice that the @CacheEvict does not work anymore as expected.

So, what's needed here is a deeper validation at compile time to check if the expression is sound. In this case, if the referenced field of the parameter's type exists.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read the linked issues #475 and #521 first, then locate the existing annotation and Spring Expression Language validation entry points in the tooling. The work is complete when an expression such as @CacheEvict(key = "#customer.customerId") is checked against the parameter type and an invalid renamed field is reported at compile time.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
devtools, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.