mapstruct / mapstruct/mapstruct-idea

Multi-line Java expression flagged as invalid code

Open
#98 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
168
Forks
41
PR merge metrics
No merged PRs in 30d

Description

This code snipped is flagged by IntelliJ:

    @Mapping(target = "field",
             expression = "java(EnumClass1.ENUM_VALUE_1 == dto.getEnumValue1()"
                          + " ? someValidCode()"
                          + " : otherValidCode())")

IntelliJ sees the end of the expression line as dto.getEnumValue1()" and believes that the java(...) wrapper is missing its closing parethesis.

Perhaps support for Java Text Blocks should be considered as well. See https://github.com/mapstruct/mapstruct/issues/2837.

Contributor guide

No contributing guide indexed for this repository

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

Reproduce the Java annotation example in IntelliJ and inspect the plugin's handling of the multi-line MapStruct expression. Done means the valid expression is no longer flagged as missing a closing parenthesis; Java Text Blocks are mentioned as a separate possible enhancement.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.