-
-
Notifications
You must be signed in to change notification settings - Fork 41
Add generics support #273
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
base: main
Are you sure you want to change the base?
Add generics support #273
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,7 +9,6 @@ | |
|
|
||
| import com.intellij.codeInsight.completion.LightFixtureCompletionTestCase; | ||
| import com.intellij.openapi.util.text.StringUtil; | ||
| import com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess; | ||
| import com.intellij.testFramework.LightProjectDescriptor; | ||
| import com.intellij.testFramework.PsiTestUtil; | ||
| import com.intellij.util.PathUtil; | ||
|
|
@@ -29,7 +28,13 @@ protected void setUp() throws Exception { | |
| super.setUp(); | ||
| final String mapstructLibPath = PathUtil.toSystemIndependentName( new File( BUILD_LIBS_DIRECTORY ) | ||
| .getAbsolutePath() ); | ||
| VfsRootAccess.allowRootAccess( getTestRootDisposable(), mapstructLibPath ); | ||
|
|
||
| allowAccessToDirsIfExists( | ||
| BUILD_LIBS_DIRECTORY, | ||
| "testData", | ||
| "build/test-libs" | ||
| ); | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why did you changes this code? I think this could break building on other OS (Windows)
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added this specifically to ensure the tests run correctly on Windows. Without these configurations, the testing framework is unable to access packages
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For example, before fix 14:52:40,037 FINE .intellij.openapi.command.impl - finishCommand: name = Renaming method setTestName(String) of class org.mapstruct.intellij.test.examples.SimpleMapper.Target to setNewName, groupId = null
14:52:40,039 SEVERE #TestFramework - Test failed
com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess$VfsRootAccessNotAllowedError: File accessed outside allowed roots: file://D:/projects/github/mapstruct-idea/testData/usages/RenameTargetReferenceAfter.java; |
||
| PsiTestUtil.addLibrary( | ||
| myFixture.getProjectDisposable(), | ||
| myFixture.getModule(), | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| /* | ||
| * Copyright MapStruct Authors. | ||
| * | ||
| * Licensed under the Apache License version 2.0, available at https://www.apache.org/licenses/LICENSE-2.0 | ||
| */ | ||
| package org.mapstruct.ap.test.complex; | ||
|
|
||
| import org.mapstruct.Mapper; | ||
| import org.mapstruct.Mapping; | ||
|
|
||
| @Mapper | ||
| public interface GenericCarWrapperMapper { | ||
|
|
||
| @Mapping(target = "id", source = "wrapper.car.<caret>winCode") | ||
| CarEntity toCarDto(CarWrapper<Car> wrapper); | ||
| } | ||
|
|
||
| class CarEntity { | ||
|
|
||
| private String id; | ||
|
|
||
| public String getId() { | ||
| return id; | ||
| } | ||
|
|
||
| public void setId(String id) { | ||
| this.id = id; | ||
| } | ||
|
|
||
| } | ||
|
|
||
| class Car { | ||
|
|
||
| private String winCode; | ||
|
|
||
| public String getWinCode() { | ||
| return winCode; | ||
| } | ||
|
|
||
| public void setWinCode(String winCode) { | ||
| this.winCode = winCode; | ||
| } | ||
| } | ||
|
|
||
| class CarWrapper<T> { | ||
|
|
||
| private T car; | ||
|
|
||
| public T getCar() { | ||
| return car; | ||
| } | ||
|
|
||
| public void setCar(T car) { | ||
| this.car = car; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| /* | ||
| * Copyright MapStruct Authors. | ||
| * | ||
| * Licensed under the Apache License version 2.0, available at https://www.apache.org/licenses/LICENSE-2.0 | ||
| */ | ||
| package org.mapstruct.ap.test.complex; | ||
|
|
||
| import org.mapstruct.Mapper; | ||
| import org.mapstruct.Mapping; | ||
|
|
||
| @Mapper | ||
| public interface GenericCarWrapperSourceAutoCompleteAfterCarWithoutParameterPrefix { | ||
| @Mapping(target = "id", source = "car.<caret>winCode") | ||
| CarEntity toCarDto(CarWrapper<Car> wrapper); | ||
| } | ||
|
|
||
| class CarEntity { | ||
| private String id; | ||
| public String getId() { | ||
| return id; | ||
| } | ||
| public void setId(String id) { | ||
| this.id = id; | ||
| } | ||
| } | ||
|
|
||
| class Car { | ||
| private String winCode; | ||
| public String getWinCode() { | ||
| return winCode; | ||
| } | ||
| public void setWinCode(String winCode) { | ||
| this.winCode = winCode; | ||
| } | ||
| } | ||
|
|
||
| class CarWrapper<T> { | ||
| private T car; | ||
| public T getCar() { | ||
| return car; | ||
| } | ||
| public void setCar(T car) { | ||
| this.car = car; | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checkstyle 8.36.1 cannot parse Java pattern-matching switch expressions (used in resolvedType()), e.g.:
Output before up version