mirror of
https://github.com/mapstruct/mapstruct.git
synced 2025-07-12 00:00:08 +08:00
#779 Allow to select only one compiler in a processor test class, but make the config-annotation deprecated to empasise that it's only to be used temporarily during debugging.
This commit is contained in:
parent
c595bd72e3
commit
9b2145c6a8
@ -60,7 +60,18 @@ public class AnnotationProcessorTestRunner extends ParentRunner<Runner> {
|
||||
public AnnotationProcessorTestRunner(Class<?> klass) throws Exception {
|
||||
super( klass );
|
||||
|
||||
runners = Arrays.<Runner> asList(
|
||||
runners = createRunners( klass );
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private List<Runner> createRunners(Class<?> klass) throws Exception {
|
||||
WithSingleCompiler singleCompiler = klass.getAnnotation( WithSingleCompiler.class );
|
||||
|
||||
if (singleCompiler != null) {
|
||||
return Arrays.<Runner> asList( new InnerAnnotationProcessorRunner( klass, singleCompiler.value() ) );
|
||||
}
|
||||
|
||||
return Arrays.<Runner> asList(
|
||||
new InnerAnnotationProcessorRunner( klass, Compiler.JDK ),
|
||||
new InnerAnnotationProcessorRunner( klass, Compiler.ECLIPSE ) );
|
||||
}
|
||||
|
@ -0,0 +1,42 @@
|
||||
/**
|
||||
* Copyright 2012-2016 Gunnar Morling (http://www.gunnarmorling.de/)
|
||||
* and/or other contributors as indicated by the @authors tag. See the
|
||||
* copyright.txt file in the distribution for a full listing of all
|
||||
* contributors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mapstruct.ap.testutil.runner;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Temporarily only use the specified compiler for the test during debugging / implementation.
|
||||
* <p>
|
||||
* Do not commit tests with this annotation present!
|
||||
*
|
||||
* @deprecated Do not commit tests with this annotation present. Tests are expected to work with all compilers.
|
||||
* @author Andreas Gudian
|
||||
*/
|
||||
@Deprecated
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface WithSingleCompiler {
|
||||
/**
|
||||
* @return The compiler to use.
|
||||
*/
|
||||
Compiler value();
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user