-
-
Notifications
You must be signed in to change notification settings - Fork 1k
feat:#2773 #2969
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
Closed
Closed
feat:#2773 #2969
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
ffa2993
feat: Copy the method annotation to the implementation method
chenzijia12300 6eeaff8
feat: Add method annotation copy supporting IterableMapping,MapMappin…
chenzijia12300 0fb8856
feat: Copy the method annotation to the implementation method
chenzijia12300 e1d19a5
feat: Add method annotation copy supporting IterableMapping,MapMappin…
chenzijia12300 9dc0f16
feat: Reimplement #2733
chenzijia12300 bb0f488
Merge remote-tracking branch 'origin/keep-method-annotations' into ke…
chenzijia12300 042a034
fix bug
chenzijia12300 e4d7125
fix: Adjust if statements to avoid printing useless newlines
chenzijia12300 fc5495a
adjust unit test
chenzijia12300 92288c4
docs: add license
chenzijia12300 2db350d
docs: add header license
chenzijia12300 73d6e0c
docs: checkstyle
chenzijia12300 13e95c7
fix bug
chenzijia12300 138ee37
feat: Support for implementing classes carrying the @Deprecated annot…
chenzijia12300 3ce4501
Merge branch 'master' into feat2773
chenzijia12300 d5b66ad
Merge branch 'mapstruct:main' into feat2773
chenzijia12300 b98dc9c
Merge remote-tracking branch 'origin/feat2773' into feat2773
chenzijia12300 e7a637c
Merge branch 'mapstruct:main' into feat2773
chenzijia12300 cd2baf9
Merge remote-tracking branch 'origin/feat2773' into feat2773
chenzijia12300 54d0444
feat: Remove redundant judgments and revert BeanMappingMethod change
chenzijia12300 2174db2
feat: revert BeanMappingMethod change
chenzijia12300 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
processor/src/test/java/org/mapstruct/ap/test/bugs/_2773/ChartEntry.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| /* | ||
| * Copyright MapStruct Authors. | ||
| * | ||
| * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 | ||
| */ | ||
| package org.mapstruct.ap.test.bugs._2773; | ||
|
|
||
| /** | ||
| * @author orange add | ||
| */ | ||
| public class ChartEntry { | ||
|
|
||
| private String chartName; | ||
| private String songTitle; | ||
| private String artistName; | ||
| private String recordedAt; | ||
| private String city; | ||
| private int position; | ||
|
|
||
| public String getChartName() { | ||
| return chartName; | ||
| } | ||
|
|
||
| public void setChartName(String chartName) { | ||
| this.chartName = chartName; | ||
| } | ||
|
|
||
| public String getSongTitle() { | ||
| return songTitle; | ||
| } | ||
|
|
||
| public void setSongTitle(String songTitle) { | ||
| this.songTitle = songTitle; | ||
| } | ||
|
|
||
| public String getArtistName() { | ||
| return artistName; | ||
| } | ||
|
|
||
| public void setArtistName(String artistName) { | ||
| this.artistName = artistName; | ||
| } | ||
|
|
||
| public String getRecordedAt() { | ||
| return recordedAt; | ||
| } | ||
|
|
||
| public void setRecordedAt(String recordedAt) { | ||
| this.recordedAt = recordedAt; | ||
| } | ||
|
|
||
| public String getCity() { | ||
| return city; | ||
| } | ||
|
|
||
| public void setCity(String city) { | ||
| this.city = city; | ||
| } | ||
|
|
||
| public int getPosition() { | ||
| return position; | ||
| } | ||
|
|
||
| public void setPosition(int position) { | ||
| this.position = position; | ||
| } | ||
| } |
51 changes: 51 additions & 0 deletions
51
processor/src/test/java/org/mapstruct/ap/test/bugs/_2773/Issue2773Mapper.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| /* | ||
| * Copyright MapStruct Authors. | ||
| * | ||
| * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 | ||
| */ | ||
| package org.mapstruct.ap.test.bugs._2773; | ||
|
|
||
| import org.mapstruct.IterableMapping; | ||
| import org.mapstruct.MapMapping; | ||
| import org.mapstruct.Mapper; | ||
| import org.mapstruct.Mapping; | ||
| import org.mapstruct.Mappings; | ||
| import org.mapstruct.factory.Mappers; | ||
|
|
||
| import java.util.Date; | ||
| import java.util.List; | ||
| import java.util.Map; | ||
| import java.util.Set; | ||
| import java.util.stream.Stream; | ||
|
|
||
| /** | ||
| * @author orange add | ||
| */ | ||
|
|
||
| @Mapper | ||
| @Deprecated | ||
| public interface Issue2773Mapper { | ||
|
|
||
| Issue2773Mapper INSTANCE = Mappers.getMapper( Issue2773Mapper.class ); | ||
|
|
||
| @Deprecated | ||
| @TestAnnotation(name = "hello", id = 1, address = {"shenzhen", "guangzhou"}) | ||
| @Mapping(target = "name", source = "chartEntry1.recordedAt") | ||
| @Mapping(target = "city", source = "chartEntry2.city") | ||
| Studio toStudio(ChartEntry chartEntry1, ChartEntry chartEntry2); | ||
|
|
||
| @Mappings({@Mapping(target = "city", source = "city"), @Mapping(target = "name", source = "recordedAt")}) | ||
| Studio map(ChartEntry chartEntry); | ||
|
|
||
| @Deprecated | ||
| @IterableMapping(numberFormat = "$#.00") | ||
| List<String> prices(List<Integer> prices); | ||
|
|
||
| @Deprecated | ||
| Set<String> integerStreamToStringSet(Stream<Integer> integers); | ||
|
|
||
| @Deprecated | ||
| @MapMapping(valueDateFormat = "dd.MM.yyyy") | ||
| Map<String, String> longDateMapToStringStringMap(Map<Long, Date> source); | ||
|
|
||
| } |
41 changes: 41 additions & 0 deletions
41
processor/src/test/java/org/mapstruct/ap/test/bugs/_2773/Issue2773Test.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| /* | ||
| * Copyright MapStruct Authors. | ||
| * | ||
| * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 | ||
| */ | ||
| package org.mapstruct.ap.test.bugs._2773; | ||
|
|
||
| import org.mapstruct.ap.testutil.IssueKey; | ||
| import org.mapstruct.ap.testutil.ProcessorTest; | ||
| import org.mapstruct.ap.testutil.WithClasses; | ||
|
|
||
| import java.lang.reflect.Method; | ||
| import java.util.List; | ||
| import java.util.Map; | ||
| import java.util.stream.Stream; | ||
|
|
||
| import static org.assertj.core.api.Assertions.assertThat; | ||
|
|
||
| /** | ||
| * @author orange add | ||
| */ | ||
| @IssueKey("2773") | ||
| public class Issue2773Test { | ||
|
|
||
| @ProcessorTest | ||
| @WithClasses({ChartEntry.class, Issue2773Mapper.class, Studio.class, TestAnnotation.class}) | ||
| public void shouldContainMethodAnnotations() throws NoSuchMethodException { | ||
| Issue2773Mapper issue2773Mapper = Issue2773Mapper.INSTANCE; | ||
| Class<? extends Issue2773Mapper> mapperClass = issue2773Mapper.getClass(); | ||
| Method toStudio = mapperClass.getMethod( "toStudio", ChartEntry.class, ChartEntry.class ); | ||
| Method prices = mapperClass.getMethod( "prices", List.class ); | ||
| Method integerStreamToStringSet = mapperClass.getMethod( "integerStreamToStringSet", Stream.class ); | ||
| Method longDateMapToStringStringMap = mapperClass.getMethod( "longDateMapToStringStringMap", Map.class ); | ||
| assertThat( mapperClass.getAnnotation( Deprecated.class ) ).isNotNull(); | ||
| assertThat( toStudio.getAnnotation( Deprecated.class ) ).isNotNull(); | ||
| assertThat( prices.getAnnotation( Deprecated.class ) ).isNotNull(); | ||
| assertThat( integerStreamToStringSet.getAnnotation( Deprecated.class ) ).isNotNull(); | ||
| assertThat( longDateMapToStringStringMap.getAnnotation( Deprecated.class ) ).isNotNull(); | ||
| } | ||
|
|
||
| } |
31 changes: 31 additions & 0 deletions
31
processor/src/test/java/org/mapstruct/ap/test/bugs/_2773/Studio.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| /* | ||
| * Copyright MapStruct Authors. | ||
| * | ||
| * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 | ||
| */ | ||
| package org.mapstruct.ap.test.bugs._2773; | ||
|
|
||
| /** | ||
| * @author orange add | ||
| */ | ||
| public class Studio { | ||
|
|
||
| private String city; | ||
| private String name; | ||
|
|
||
| public String getCity() { | ||
| return city; | ||
| } | ||
|
|
||
| public void setCity(String city) { | ||
| this.city = city; | ||
| } | ||
|
|
||
| public String getName() { | ||
| return name; | ||
| } | ||
|
|
||
| public void setName(String name) { | ||
| this.name = name; | ||
| } | ||
| } |
25 changes: 25 additions & 0 deletions
25
processor/src/test/java/org/mapstruct/ap/test/bugs/_2773/TestAnnotation.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| /* | ||
| * Copyright MapStruct Authors. | ||
| * | ||
| * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 | ||
| */ | ||
| package org.mapstruct.ap.test.bugs._2773; | ||
|
|
||
| import java.lang.annotation.ElementType; | ||
| import java.lang.annotation.Retention; | ||
| import java.lang.annotation.RetentionPolicy; | ||
| import java.lang.annotation.Target; | ||
| /** | ||
| * @author orange add | ||
| */ | ||
|
|
||
| @Target(ElementType.METHOD) | ||
| @Retention(RetentionPolicy.RUNTIME) | ||
| public @interface TestAnnotation { | ||
|
|
||
| int id(); | ||
|
|
||
| String name(); | ||
|
|
||
| String[] address(); | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.