Skip to content

Commit c410379

Browse files
committed
mapstruct#1553: Update tycho-compiler-jdt to latest 1.6.0 version
Disable one test in GenericsHierarchyTest for Eclipse on Java 8 due to a bug in the Tycho compiler. Disable freeBuilder integration test for Eclipse since there are some problems in the second round of annotation processing (no ModelElementProcessor(s) are found)
1 parent 853ff7f commit c410379

12 files changed

Lines changed: 127 additions & 30 deletions

File tree

integrationtest/src/test/java/org/mapstruct/itest/tests/MavenIntegrationTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ void externalBeanJarTest() {
3636
}
3737

3838
@ProcessorTest(baseDir = "freeBuilderBuilderTest", processorTypes = {
39-
ProcessorTest.ProcessorType.JAVAC,
40-
ProcessorTest.ProcessorType.ECLIPSE_JDT
39+
ProcessorTest.ProcessorType.JAVAC
4140
})
4241
void freeBuilderBuilderTest() {
4342
}

parent/pom.xml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<org.apache.maven.plugins.surefire.version>3.0.0-M3</org.apache.maven.plugins.surefire.version>
2828
<org.apache.maven.plugins.javadoc.version>3.1.0</org.apache.maven.plugins.javadoc.version>
2929
<org.springframework.version>4.0.3.RELEASE</org.springframework.version>
30-
<org.eclipse.tycho.compiler-jdt.version>0.26.0</org.eclipse.tycho.compiler-jdt.version>
30+
<org.eclipse.tycho.compiler-jdt.version>1.6.0</org.eclipse.tycho.compiler-jdt.version>
3131
<com.puppycrawl.tools.checkstyle.version>8.29</com.puppycrawl.tools.checkstyle.version>
3232
<org.junit.jupiter.version>5.6.0</org.junit.jupiter.version>
3333
<add.release.arguments />
@@ -237,13 +237,28 @@
237237
<dependency>
238238
<groupId>org.codehaus.plexus</groupId>
239239
<artifactId>plexus-container-default</artifactId>
240-
<version>1.6</version>
240+
<version>1.7.1</version>
241+
</dependency>
242+
<dependency>
243+
<groupId>org.codehaus.plexus</groupId>
244+
<artifactId>plexus-component-annotations</artifactId>
245+
<version>1.7.1</version>
246+
</dependency>
247+
<dependency>
248+
<groupId>org.codehaus.plexus</groupId>
249+
<artifactId>plexus-classworlds</artifactId>
250+
<version>2.5.1</version>
241251
</dependency>
242252
<dependency>
243253
<groupId>org.codehaus.plexus</groupId>
244254
<artifactId>plexus-utils</artifactId>
245255
<version>3.0.20</version>
246256
</dependency>
257+
<dependency>
258+
<groupId>commons-io</groupId>
259+
<artifactId>commons-io</artifactId>
260+
<version>2.5</version>
261+
</dependency>
247262

248263
<!-- Project modules -->
249264
<dependency>

processor/src/test/java/org/mapstruct/ap/test/abstractclass/generics/GenericsHierarchyTest.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
import org.mapstruct.ap.testutil.IssueKey;
1313
import org.mapstruct.ap.testutil.WithClasses;
1414
import org.mapstruct.ap.testutil.runner.AnnotationProcessorTestRunner;
15+
import org.mapstruct.ap.testutil.runner.Compiler;
16+
import org.mapstruct.ap.testutil.runner.DisabledOnCompiler;
1517

1618
/**
1719
* @author Andreas Gudian
@@ -34,6 +36,13 @@
3436
public class GenericsHierarchyTest {
3537

3638
@Test
39+
// Disabled due to a bug in the Eclipse compiler (https://bugs.eclipse.org/bugs/show_bug.cgi?id=540101)
40+
// See https://github.com/mapstruct/mapstruct/issues/1553 and https://github.com/mapstruct/mapstruct/pull/1587
41+
// for more information
42+
@DisabledOnCompiler( {
43+
Compiler.ECLIPSE,
44+
Compiler.ECLIPSE11
45+
} )
3746
public void determinesAnimalKeyGetter() {
3847
AbstractAnimal source = new Elephant();
3948

processor/src/test/java/org/mapstruct/ap/test/conversion/date/DateConversionTest.java

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,10 @@ public void tearDown() {
5555
}
5656

5757
@Test
58-
@DisabledOnCompiler(Compiler.JDK11)
58+
@DisabledOnCompiler({
59+
Compiler.JDK11,
60+
Compiler.ECLIPSE11
61+
})
5962
// See https://bugs.openjdk.java.net/browse/JDK-8211262, there is a difference in the default formats on Java 9+
6063
public void shouldApplyDateFormatForConversions() {
6164
Source source = new Source();
@@ -70,7 +73,10 @@ public void shouldApplyDateFormatForConversions() {
7073
}
7174

7275
@Test
73-
@EnabledOnCompiler(Compiler.JDK11)
76+
@EnabledOnCompiler({
77+
Compiler.JDK11,
78+
Compiler.ECLIPSE11
79+
})
7480
// See https://bugs.openjdk.java.net/browse/JDK-8211262, there is a difference in the default formats on Java 9+
7581
public void shouldApplyDateFormatForConversionsJdk11() {
7682
Source source = new Source();
@@ -85,7 +91,10 @@ public void shouldApplyDateFormatForConversionsJdk11() {
8591
}
8692

8793
@Test
88-
@DisabledOnCompiler(Compiler.JDK11)
94+
@DisabledOnCompiler({
95+
Compiler.JDK11,
96+
Compiler.ECLIPSE11
97+
})
8998
// See https://bugs.openjdk.java.net/browse/JDK-8211262, there is a difference in the default formats on Java 9+
9099
public void shouldApplyDateFormatForConversionInReverseMapping() {
91100
Target target = new Target();
@@ -102,7 +111,10 @@ public void shouldApplyDateFormatForConversionInReverseMapping() {
102111
}
103112

104113
@Test
105-
@EnabledOnCompiler(Compiler.JDK11)
114+
@EnabledOnCompiler({
115+
Compiler.JDK11,
116+
Compiler.ECLIPSE11
117+
})
106118
// See https://bugs.openjdk.java.net/browse/JDK-8211262, there is a difference in the default formats on Java 9+
107119
public void shouldApplyDateFormatForConversionInReverseMappingJdk11() {
108120
Target target = new Target();

processor/src/test/java/org/mapstruct/ap/test/conversion/jodatime/JodaConversionTest.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,10 @@ public void testLocalTimeToString() {
8787
}
8888

8989
@Test
90-
@DisabledOnCompiler(Compiler.JDK11)
90+
@DisabledOnCompiler({
91+
Compiler.JDK11,
92+
Compiler.ECLIPSE11
93+
})
9194
// See https://bugs.openjdk.java.net/browse/JDK-8211262, there is a difference in the default formats on Java 9+
9295
public void testSourceToTargetMappingForStrings() {
9396
Source src = new Source();
@@ -115,7 +118,10 @@ public void testSourceToTargetMappingForStrings() {
115118
}
116119

117120
@Test
118-
@EnabledOnCompiler(Compiler.JDK11)
121+
@EnabledOnCompiler({
122+
Compiler.JDK11,
123+
Compiler.ECLIPSE11
124+
})
119125
// See https://bugs.openjdk.java.net/browse/JDK-8211262, there is a difference in the default formats on Java 9+
120126
public void testSourceToTargetMappingForStringsJdk11() {
121127
Source src = new Source();

processor/src/test/java/org/mapstruct/ap/test/verbose/VerboseTest.java

Lines changed: 44 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@
3030
public class VerboseTest {
3131

3232
@Test
33-
@DisabledOnCompiler( Compiler.ECLIPSE )
33+
@DisabledOnCompiler( {
34+
Compiler.ECLIPSE,
35+
Compiler.ECLIPSE11
36+
} )
3437
@ProcessorOption(name = "mapstruct.verbose", value = "true")
3538
@WithClasses({ CreateBeanMapping.class, CreateBeanMappingConfig.class })
3639
@ExpectedNote("^MapStruct: Using accessor naming strategy:.*DefaultAccessorNamingStrategy.*$")
@@ -41,7 +44,10 @@ public void testGeneralMessages() {
4144
}
4245

4346
@Test
44-
@DisabledOnCompiler( Compiler.ECLIPSE )
47+
@DisabledOnCompiler( {
48+
Compiler.ECLIPSE,
49+
Compiler.ECLIPSE11
50+
} )
4551
@WithServiceImplementation(provides = BuilderProvider.class, value = ImmutablesBuilderProvider.class)
4652
@WithServiceImplementation(provides = AccessorNamingStrategy.class, value = ImmutablesAccessorNamingStrategy.class)
4753
@ProcessorOption(name = "mapstruct.verbose", value = "true")
@@ -54,7 +60,10 @@ public void testGeneralWithOtherSPI() {
5460
}
5561

5662
@Test
57-
@DisabledOnCompiler( Compiler.ECLIPSE )
63+
@DisabledOnCompiler( {
64+
Compiler.ECLIPSE,
65+
Compiler.ECLIPSE11
66+
} )
5867
@WithServiceImplementation(provides = AstModifyingAnnotationProcessor.class,
5968
value = AstModifyingAnnotationProcessorSaysNo.class)
6069
@ProcessorOption(name = "mapstruct.verbose", value = "true")
@@ -73,7 +82,10 @@ public void testDeferred() {
7382
}
7483

7584
@Test
76-
@DisabledOnCompiler( Compiler.ECLIPSE )
85+
@DisabledOnCompiler( {
86+
Compiler.ECLIPSE,
87+
Compiler.ECLIPSE11
88+
} )
7789
@ProcessorOption(name = "mapstruct.verbose", value = "true")
7890
@WithClasses({ CreateBeanMapping.class, CreateBeanMappingConfig.class })
7991
@ExpectedNote("^- MapStruct: creating bean mapping method implementation for.*$")
@@ -82,7 +94,10 @@ public void testCreateBeanMapping() {
8294
}
8395

8496
@Test
85-
@DisabledOnCompiler( Compiler.ECLIPSE )
97+
@DisabledOnCompiler( {
98+
Compiler.ECLIPSE,
99+
Compiler.ECLIPSE11
100+
} )
86101
@ProcessorOption(name = "mapstruct.verbose", value = "true")
87102
@WithClasses(SelectBeanMapping.class)
88103
@ExpectedNote("^- MapStruct: creating bean mapping method implementation for.*$")
@@ -91,15 +106,21 @@ public void testSelectBeanMapping() {
91106
}
92107

93108
@Test
94-
@DisabledOnCompiler( Compiler.ECLIPSE )
109+
@DisabledOnCompiler( {
110+
Compiler.ECLIPSE,
111+
Compiler.ECLIPSE11
112+
} )
95113
@ProcessorOption(name = "mapstruct.verbose", value = "true")
96114
@WithClasses(ValueMapping.class)
97115
@ExpectedNote("^- MapStruct: creating value mapping method implementation for.*$")
98116
public void testValueMapping() {
99117
}
100118

101119
@Test
102-
@DisabledOnCompiler( Compiler.ECLIPSE )
120+
@DisabledOnCompiler( {
121+
Compiler.ECLIPSE,
122+
Compiler.ECLIPSE11
123+
} )
103124
@ProcessorOption(name = "mapstruct.verbose", value = "true")
104125
@WithClasses(CreateIterableMapping.class)
105126
@ExpectedNote("^- MapStruct: creating iterable mapping method implementation for.*$")
@@ -108,7 +129,10 @@ public void testVerboseCreateIterableMapping() {
108129
}
109130

110131
@Test
111-
@DisabledOnCompiler( Compiler.ECLIPSE )
132+
@DisabledOnCompiler( {
133+
Compiler.ECLIPSE,
134+
Compiler.ECLIPSE11
135+
} )
112136
@ProcessorOption(name = "mapstruct.verbose", value = "true")
113137
@WithClasses(SelectIterableMapping.class)
114138
@ExpectedNote("^- MapStruct: creating iterable mapping method implementation for.*$")
@@ -117,15 +141,21 @@ public void testVerboseSelectingIterableMapping() {
117141
}
118142

119143
@Test
120-
@DisabledOnCompiler( Compiler.ECLIPSE )
144+
@DisabledOnCompiler( {
145+
Compiler.ECLIPSE,
146+
Compiler.ECLIPSE11
147+
} )
121148
@ProcessorOption(name = "mapstruct.verbose", value = "true")
122149
@WithClasses(SelectStreamMapping.class)
123150
@ExpectedNote("^- MapStruct: creating stream mapping method implementation for.*$")
124151
public void testVerboseSelectingStreamMapping() {
125152
}
126153

127154
@Test
128-
@DisabledOnCompiler( Compiler.ECLIPSE )
155+
@DisabledOnCompiler( {
156+
Compiler.ECLIPSE,
157+
Compiler.ECLIPSE11
158+
} )
129159
@ProcessorOption(name = "mapstruct.verbose", value = "true")
130160
@WithClasses(CreateMapMapping.class)
131161
@ExpectedNote("^- MapStruct: creating map mapping method implementation for.*$")
@@ -135,7 +165,10 @@ public void testVerboseCreateMapMapping() {
135165
}
136166

137167
@Test
138-
@DisabledOnCompiler( Compiler.ECLIPSE )
168+
@DisabledOnCompiler( {
169+
Compiler.ECLIPSE,
170+
Compiler.ECLIPSE11
171+
} )
139172
@ProcessorOption(name = "mapstruct.verbose", value = "true")
140173
@WithClasses(SelectMapMapping.class)
141174
@ExpectedNote("^- MapStruct: creating map mapping method implementation for.*$")

processor/src/test/java/org/mapstruct/ap/testutil/runner/AnnotationProcessorTestRunner.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,10 @@ else if ( IS_AT_LEAST_JAVA_9 ) {
7474
// Current tycho-compiler-jdt (0.26.0) is not compatible with Java 11
7575
// Updating to latest version 1.3.0 fails some tests
7676
// Once https://github.com/mapstruct/mapstruct/pull/1587 is resolved we can remove this line
77-
return Arrays.asList( new InnerAnnotationProcessorRunner( klass, Compiler.JDK11 ) );
77+
return Arrays.asList(
78+
new InnerAnnotationProcessorRunner( klass, Compiler.JDK11 ),
79+
new InnerAnnotationProcessorRunner( klass, Compiler.ECLIPSE11 )
80+
);
7881
}
7982

8083
return Arrays.asList(

processor/src/test/java/org/mapstruct/ap/testutil/runner/Compiler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010
*
1111
*/
1212
public enum Compiler {
13-
JDK, JDK11, ECLIPSE;
13+
JDK, JDK11, ECLIPSE, ECLIPSE11;
1414
}

processor/src/test/java/org/mapstruct/ap/testutil/runner/DisabledOnCompiler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@
2222
/**
2323
* @return The compiler to use.
2424
*/
25-
Compiler value();
25+
Compiler[] value();
2626
}

processor/src/test/java/org/mapstruct/ap/testutil/runner/EclipseCompilingStatement.java

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
import java.util.List;
1010
import java.util.Set;
1111

12+
import javax.lang.model.SourceVersion;
13+
1214
import org.codehaus.plexus.compiler.CompilerConfiguration;
1315
import org.codehaus.plexus.compiler.CompilerException;
1416
import org.codehaus.plexus.compiler.CompilerResult;
@@ -108,9 +110,10 @@ public CompilationOutcomeDescriptor compileInOtherClassloader(CompilationRequest
108110
config.setGeneratedSourcesDirectory( new File( sourceOutputDir ) );
109111
config.setAnnotationProcessors( new String[] { MappingProcessor.class.getName() } );
110112
config.setSourceFiles( sourceFiles );
113+
String version = getSourceVersion();
111114
config.setShowWarnings( false );
112-
config.setSourceVersion( "1.8" );
113-
config.setTargetVersion( "1.8" );
115+
config.setSourceVersion( version );
116+
config.setTargetVersion( version );
114117

115118
for ( String option : compilationRequest.getProcessorOptions() ) {
116119
config.addCompilerCustomArgument( option, null );
@@ -128,13 +131,22 @@ public CompilationOutcomeDescriptor compileInOtherClassloader(CompilationRequest
128131
sourceDir,
129132
compilerResult );
130133
}
134+
135+
private static String getSourceVersion() {
136+
SourceVersion latest = SourceVersion.latest();
137+
if ( latest == SourceVersion.RELEASE_8 ) {
138+
return "1.8";
139+
}
140+
return "11";
141+
}
142+
131143
}
132144

133145
private static List<String> buildEclipseCompilerClasspath() {
134146
String[] whitelist =
135147
new String[] {
136148
"tycho-compiler",
137-
"org.eclipse.jdt.",
149+
"ecj",
138150
"plexus-compiler-api",
139151
"plexus-component-annotations" };
140152

0 commit comments

Comments
 (0)