From 51e33cb3438f16f3ed11b551335503186f66b789 Mon Sep 17 00:00:00 2001 From: sjaakd Date: Mon, 21 Apr 2014 12:11:08 +0200 Subject: [PATCH] #198 fixing comments @agudian and applying throws clause to all MappingMethods --- .../mapstruct/ap/model/BeanMappingMethod.java | 6 -- .../org/mapstruct/ap/model/MappingMethod.java | 8 +- .../ap/model/assignment/LocalVarWrapper.java | 12 ++- .../ap/model/assignment/MethodReference.java | 11 ++- .../ap/model/assignment/SetterWrapper.java | 13 ++- .../org/mapstruct/ap/model/source/Method.java | 7 ++ .../ap/model/source/SourceMethod.java | 2 +- .../model/source/builtin/BuiltInMethod.java | 5 ++ .../ap/processor/MapperCreationProcessor.java | 8 +- ...g.mapstruct.ap.model.BeanMappingMethod.ftl | 12 ++- ...rg.mapstruct.ap.model.DelegatingMethod.ftl | 13 ++- ...pstruct.ap.model.IterableMappingMethod.ftl | 13 ++- ...rg.mapstruct.ap.model.MapMappingMethod.ftl | 11 ++- .../ap/test/exceptions/ExceptionTest.java | 89 +++++++++++++++++-- .../exceptions/ExceptionTestDecorator.java | 28 ++++++ .../test/exceptions/ExceptionTestMapper.java | 12 +++ .../test/exceptions/SourceTargetMapper.java | 13 +++ .../ap/test/exceptions/TestException2.java | 4 +- .../{ => imports}/TestException1.java | 2 +- .../exceptions/imports/TestExceptionBase.java | 26 ++++++ 20 files changed, 259 insertions(+), 36 deletions(-) create mode 100644 processor/src/test/java/org/mapstruct/ap/test/exceptions/ExceptionTestDecorator.java rename processor/src/test/java/org/mapstruct/ap/test/exceptions/{ => imports}/TestException1.java (94%) create mode 100644 processor/src/test/java/org/mapstruct/ap/test/exceptions/imports/TestExceptionBase.java diff --git a/processor/src/main/java/org/mapstruct/ap/model/BeanMappingMethod.java b/processor/src/main/java/org/mapstruct/ap/model/BeanMappingMethod.java index 026644397..65a9ed6e7 100644 --- a/processor/src/main/java/org/mapstruct/ap/model/BeanMappingMethod.java +++ b/processor/src/main/java/org/mapstruct/ap/model/BeanMappingMethod.java @@ -39,7 +39,6 @@ public class BeanMappingMethod extends MappingMethod { private final List propertyMappings; private final FactoryMethod factoryMethod; - private final List exceptionTypes; public BeanMappingMethod(SourceMethod method, List propertyMappings, @@ -47,7 +46,6 @@ public class BeanMappingMethod extends MappingMethod { super( method ); this.propertyMappings = propertyMappings; this.factoryMethod = factoryMethod; - this.exceptionTypes = method.getExceptionTypes(); } public List getPropertyMappings() { @@ -83,8 +81,4 @@ public class BeanMappingMethod extends MappingMethod { public FactoryMethod getFactoryMethod() { return this.factoryMethod; } - - public List getExceptionTypes() { - return exceptionTypes; - } } diff --git a/processor/src/main/java/org/mapstruct/ap/model/MappingMethod.java b/processor/src/main/java/org/mapstruct/ap/model/MappingMethod.java index 49656c322..ab3b4ab6a 100644 --- a/processor/src/main/java/org/mapstruct/ap/model/MappingMethod.java +++ b/processor/src/main/java/org/mapstruct/ap/model/MappingMethod.java @@ -42,6 +42,7 @@ public abstract class MappingMethod extends ModelElement { private final Type returnType; private final Parameter targetParameter; private final Accessibility accessibility; + private final List thrownTypes; protected MappingMethod(Method method) { this.name = method.getName(); @@ -49,6 +50,7 @@ public abstract class MappingMethod extends ModelElement { this.returnType = method.getReturnType(); this.targetParameter = method.getTargetParameter(); this.accessibility = method.getAccessibility(); + this.thrownTypes = method.getThrownTypes(); } public String getName() { @@ -102,7 +104,7 @@ public abstract class MappingMethod extends ModelElement { types.add( getReturnType() ); types.addAll( getReturnType().getImportTypes() ); - + types.addAll( thrownTypes ); return types; } @@ -116,6 +118,10 @@ public abstract class MappingMethod extends ModelElement { return parameterNames; } + public List getThrownTypes() { + return thrownTypes; + } + @Override public String toString() { return returnType + " " + getName() + "(" + Strings.join( parameters, ", " ) + ")"; diff --git a/processor/src/main/java/org/mapstruct/ap/model/assignment/LocalVarWrapper.java b/processor/src/main/java/org/mapstruct/ap/model/assignment/LocalVarWrapper.java index 34b2d76c4..cf3fb7693 100644 --- a/processor/src/main/java/org/mapstruct/ap/model/assignment/LocalVarWrapper.java +++ b/processor/src/main/java/org/mapstruct/ap/model/assignment/LocalVarWrapper.java @@ -18,6 +18,7 @@ */ package org.mapstruct.ap.model.assignment; +import java.util.ArrayList; import java.util.List; import org.mapstruct.ap.model.Assignment; import org.mapstruct.ap.model.common.Type; @@ -38,9 +39,14 @@ public class LocalVarWrapper extends AssignmentWrapper { @Override public List getExceptionTypes() { - List result = super.getExceptionTypes(); - for (Type exceptionTypeToExclude : exceptionTypesToExclude) { - result.remove( exceptionTypeToExclude ); + List parentExceptionTypes = super.getExceptionTypes(); + List result = new ArrayList( parentExceptionTypes ); + for ( Type exceptionTypeToExclude : exceptionTypesToExclude ) { + for ( Type parentExceptionType : parentExceptionTypes ) { + if ( parentExceptionType.isAssignableTo( exceptionTypeToExclude ) ) { + result.remove( parentExceptionType ); + } + } } return result; } diff --git a/processor/src/main/java/org/mapstruct/ap/model/assignment/MethodReference.java b/processor/src/main/java/org/mapstruct/ap/model/assignment/MethodReference.java index 3d809e97c..60bb09718 100644 --- a/processor/src/main/java/org/mapstruct/ap/model/assignment/MethodReference.java +++ b/processor/src/main/java/org/mapstruct/ap/model/assignment/MethodReference.java @@ -20,6 +20,7 @@ package org.mapstruct.ap.model.assignment; import java.util.ArrayList; import java.util.Collections; +import java.util.HashSet; import java.util.List; import java.util.Set; import org.mapstruct.ap.model.Assignment; @@ -73,10 +74,12 @@ public class MethodReference extends MappingMethod implements Assignment, Factor super( method ); this.declaringMapper = declaringMapper; this.contextParam = null; - this.importTypes = targetType == null ? - Collections.emptySet() : - Collections.singleton( targetType ); - this.exceptionTypes = method.getExceptionTypes(); + Set imported = new HashSet( method.getThrownTypes() ); + if ( targetType != null ) { + imported.add( targetType ); + } + this.importTypes = Collections.unmodifiableSet( imported ); + this.exceptionTypes = method.getThrownTypes(); } public MethodReference(BuiltInMethod method, ConversionContext contextParam) { diff --git a/processor/src/main/java/org/mapstruct/ap/model/assignment/SetterWrapper.java b/processor/src/main/java/org/mapstruct/ap/model/assignment/SetterWrapper.java index d94ec9fb2..110f9bd15 100644 --- a/processor/src/main/java/org/mapstruct/ap/model/assignment/SetterWrapper.java +++ b/processor/src/main/java/org/mapstruct/ap/model/assignment/SetterWrapper.java @@ -18,6 +18,7 @@ */ package org.mapstruct.ap.model.assignment; +import java.util.ArrayList; import java.util.List; import org.mapstruct.ap.model.Assignment; import org.mapstruct.ap.model.common.Type; @@ -38,10 +39,16 @@ public class SetterWrapper extends AssignmentWrapper { @Override public List getExceptionTypes() { - List result = super.getExceptionTypes(); - for (Type exceptionTypeToExclude : exceptionTypesToExclude) { - result.remove( exceptionTypeToExclude ); + List parentExceptionTypes = super.getExceptionTypes(); + List result = new ArrayList( parentExceptionTypes ); + for ( Type exceptionTypeToExclude : exceptionTypesToExclude ) { + for ( Type parentExceptionType : parentExceptionTypes ) { + if ( parentExceptionType.isAssignableTo( exceptionTypeToExclude ) ) { + result.remove( parentExceptionType ); + } + } } return result; } + } diff --git a/processor/src/main/java/org/mapstruct/ap/model/source/Method.java b/processor/src/main/java/org/mapstruct/ap/model/source/Method.java index 45ec4ff1b..884f60c61 100644 --- a/processor/src/main/java/org/mapstruct/ap/model/source/Method.java +++ b/processor/src/main/java/org/mapstruct/ap/model/source/Method.java @@ -96,4 +96,11 @@ public interface Method { * @return return type */ Type getReturnType(); + + /** + * Returns all exceptions thrown by this method + * + * @return exceptions thrown + */ + List getThrownTypes(); } diff --git a/processor/src/main/java/org/mapstruct/ap/model/source/SourceMethod.java b/processor/src/main/java/org/mapstruct/ap/model/source/SourceMethod.java index 9b302634a..c948f3154 100644 --- a/processor/src/main/java/org/mapstruct/ap/model/source/SourceMethod.java +++ b/processor/src/main/java/org/mapstruct/ap/model/source/SourceMethod.java @@ -351,7 +351,7 @@ public class SourceMethod implements Method { return false; } - public List getExceptionTypes() { + public List getThrownTypes() { return exceptionTypes; } } diff --git a/processor/src/main/java/org/mapstruct/ap/model/source/builtin/BuiltInMethod.java b/processor/src/main/java/org/mapstruct/ap/model/source/builtin/BuiltInMethod.java index e140bcf4b..818ec4880 100644 --- a/processor/src/main/java/org/mapstruct/ap/model/source/builtin/BuiltInMethod.java +++ b/processor/src/main/java/org/mapstruct/ap/model/source/builtin/BuiltInMethod.java @@ -177,4 +177,9 @@ public abstract class BuiltInMethod implements Method { public Accessibility getAccessibility() { return Accessibility.PRIVATE; } + + @Override + public List getThrownTypes() { + return Collections.emptyList(); + } } diff --git a/processor/src/main/java/org/mapstruct/ap/processor/MapperCreationProcessor.java b/processor/src/main/java/org/mapstruct/ap/processor/MapperCreationProcessor.java index 0a629d1a0..69a53c117 100644 --- a/processor/src/main/java/org/mapstruct/ap/processor/MapperCreationProcessor.java +++ b/processor/src/main/java/org/mapstruct/ap/processor/MapperCreationProcessor.java @@ -670,7 +670,7 @@ public class MapperCreationProcessor implements ModelElementProcessor @Override -<#lt>${accessibility.keyword} <@includeModel object=returnType/> ${name}(<#list parameters as param><@includeModel object=param/><#if param_has_next>, )<@exceptions/> { +<#lt>${accessibility.keyword} <@includeModel object=returnType/> ${name}(<#list parameters as param><@includeModel object=param/><#if param_has_next>, ) <@throws/> { if ( <#list sourceParameters as sourceParam>${sourceParam.name} == null<#if sourceParam_has_next> && ) { return<#if returnType.name != "void"> null; } @@ -43,4 +43,12 @@ return ${resultName}; } -<#macro exceptions><#if (exceptionTypes?size > 0)> throws <#list exceptionTypes as exceptionType>${exceptionType.name}<#if exceptionType_has_next>, +<#macro throws> + <@compress single_line=true> + <#if (thrownTypes?size > 0)>throws + <#list thrownTypes as exceptionType> + <@includeModel object=exceptionType/> + <#if exceptionType_has_next>, + + + diff --git a/processor/src/main/resources/org.mapstruct.ap.model.DelegatingMethod.ftl b/processor/src/main/resources/org.mapstruct.ap.model.DelegatingMethod.ftl index af61c459a..90a8d6253 100644 --- a/processor/src/main/resources/org.mapstruct.ap.model.DelegatingMethod.ftl +++ b/processor/src/main/resources/org.mapstruct.ap.model.DelegatingMethod.ftl @@ -19,6 +19,15 @@ --> @Override -public <@includeModel object=returnType/> ${name}(<#list parameters as param><@includeModel object=param/><#if param_has_next>, ) { +public <@includeModel object=returnType/> ${name}(<#list parameters as param><@includeModel object=param/><#if param_has_next>, ) <@throws/> { return delegate.${name}( <#list parameters as param>${param.name}<#if param_has_next>, ); -} \ No newline at end of file +} +<#macro throws> + <@compress single_line=true> + <#if (thrownTypes?size > 0)>throws + <#list thrownTypes as exceptionType> + <@includeModel object=exceptionType/> + <#if exceptionType_has_next>, + + + \ No newline at end of file diff --git a/processor/src/main/resources/org.mapstruct.ap.model.IterableMappingMethod.ftl b/processor/src/main/resources/org.mapstruct.ap.model.IterableMappingMethod.ftl index 7ee651515..acef47362 100644 --- a/processor/src/main/resources/org.mapstruct.ap.model.IterableMappingMethod.ftl +++ b/processor/src/main/resources/org.mapstruct.ap.model.IterableMappingMethod.ftl @@ -19,7 +19,7 @@ --> @Override -<#lt>${accessibility.keyword} <@includeModel object=returnType/> ${name}(<#list parameters as param><@includeModel object=param/><#if param_has_next>, ) { +<#lt>${accessibility.keyword} <@includeModel object=returnType/> ${name}(<#list parameters as param><@includeModel object=param/><#if param_has_next>, ) <@throws/> { if ( ${sourceParameter.name} == null ) { return<#if returnType.name != "void"> null; } @@ -38,4 +38,13 @@ return ${resultName}; -} \ No newline at end of file +} +<#macro throws> + <@compress single_line=true> + <#if (thrownTypes?size > 0)>throws + <#list thrownTypes as exceptionType> + <@includeModel object=exceptionType/> + <#if exceptionType_has_next>, + + + \ No newline at end of file diff --git a/processor/src/main/resources/org.mapstruct.ap.model.MapMappingMethod.ftl b/processor/src/main/resources/org.mapstruct.ap.model.MapMappingMethod.ftl index 3c83646c8..f84b3a312 100644 --- a/processor/src/main/resources/org.mapstruct.ap.model.MapMappingMethod.ftl +++ b/processor/src/main/resources/org.mapstruct.ap.model.MapMappingMethod.ftl @@ -19,7 +19,7 @@ --> @Override -<#lt>${accessibility.keyword} <@includeModel object=returnType /> ${name}(<#list parameters as param><@includeModel object=param/><#if param_has_next>, ) { +<#lt>${accessibility.keyword} <@includeModel object=returnType /> ${name}(<#list parameters as param><@includeModel object=param/><#if param_has_next>, ) <@throws/> { if ( ${sourceParameter.name} == null ) { return<#if returnType.name != "void"> null; } @@ -53,3 +53,12 @@ <#local result><@includeModel object=type/> <#return result> +<#macro throws> + <@compress single_line=true> + <#if (thrownTypes?size > 0)>throws + <#list thrownTypes as exceptionType> + <@includeModel object=exceptionType/> + <#if exceptionType_has_next>, + + + \ No newline at end of file diff --git a/processor/src/test/java/org/mapstruct/ap/test/exceptions/ExceptionTest.java b/processor/src/test/java/org/mapstruct/ap/test/exceptions/ExceptionTest.java index fbca59146..d624f981f 100644 --- a/processor/src/test/java/org/mapstruct/ap/test/exceptions/ExceptionTest.java +++ b/processor/src/test/java/org/mapstruct/ap/test/exceptions/ExceptionTest.java @@ -18,7 +18,12 @@ */ package org.mapstruct.ap.test.exceptions; - +import org.mapstruct.ap.test.exceptions.imports.TestException1; +import org.mapstruct.ap.test.exceptions.imports.TestExceptionBase; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.junit.Test; import org.junit.runner.RunWith; import org.mapstruct.ap.testutil.IssueKey; @@ -34,27 +39,101 @@ import org.mapstruct.ap.testutil.runner.AnnotationProcessorTestRunner; Target.class, SourceTargetMapper.class, ExceptionTestMapper.class, + ExceptionTestDecorator.class, + TestExceptionBase.class, TestException1.class, TestException2.class } ) @RunWith( AnnotationProcessorTestRunner.class ) public class ExceptionTest { - @Test(expected = RuntimeException.class) + @Test( expected = RuntimeException.class ) @IssueKey( "198" ) - public void shouldThrowRuntime() throws TestException2 { + public void shouldThrowRuntimeInBeanMapping() throws TestException2 { Source source = new Source(); source.setSize( 1 ); SourceTargetMapper sourceTargetMapper = SourceTargetMapper.INSTANCE; sourceTargetMapper.sourceToTarget( source ); } - @Test(expected = TestException2.class) + @Test( expected = TestException2.class ) @IssueKey( "198" ) - public void shouldThrowTestException2() throws TestException2 { + public void shouldThrowTestException2InBeanMapping() throws TestException2 { Source source = new Source(); source.setSize( 2 ); SourceTargetMapper sourceTargetMapper = SourceTargetMapper.INSTANCE; sourceTargetMapper.sourceToTarget( source ); } + @Test( expected = RuntimeException.class ) + @IssueKey( "198" ) + public void shouldThrowRuntimeInIterableMapping() throws TestException2 { + List source = new ArrayList(); + source.add( 1 ); + SourceTargetMapper sourceTargetMapper = SourceTargetMapper.INSTANCE; + sourceTargetMapper.integerListToLongList( source ); + } + + @Test( expected = TestException2.class ) + @IssueKey( "198" ) + public void shouldThrowTestException2InIterableMapping() throws TestException2 { + List source = new ArrayList(); + source.add( 2 ); + SourceTargetMapper sourceTargetMapper = SourceTargetMapper.INSTANCE; + sourceTargetMapper.integerListToLongList( source ); + } + + @Test( expected = RuntimeException.class ) + @IssueKey( "198" ) + public void shouldThrowRuntimeInMapKeyMapping() throws TestException2 { + Map source = new HashMap(); + source.put( 1, "test" ); + SourceTargetMapper sourceTargetMapper = SourceTargetMapper.INSTANCE; + sourceTargetMapper.integerKeyMapToLongKeyMap( source ); + } + + @Test( expected = TestException2.class ) + @IssueKey( "198" ) + public void shouldThrowTestException2InMapKeyMapping() throws TestException2 { + Map source = new HashMap(); + source.put( 2, "test" ); + SourceTargetMapper sourceTargetMapper = SourceTargetMapper.INSTANCE; + sourceTargetMapper.integerKeyMapToLongKeyMap( source ); + } + + @Test( expected = RuntimeException.class ) + @IssueKey( "198" ) + public void shouldThrowRuntimeInMapValueMapping() throws TestException2 { + Map source = new HashMap(); + source.put( "test", 1 ); + SourceTargetMapper sourceTargetMapper = SourceTargetMapper.INSTANCE; + sourceTargetMapper.integerValueMapToLongValueMap( source ); + } + + @Test( expected = TestException2.class ) + @IssueKey( "198" ) + public void shouldThrowTestException2InMapValueMapping() throws TestException2 { + Map source = new HashMap(); + source.put( "test", 2 ); + SourceTargetMapper sourceTargetMapper = SourceTargetMapper.INSTANCE; + sourceTargetMapper.integerValueMapToLongValueMap( source ); + } + + + @Test( expected = RuntimeException.class ) + @IssueKey( "198" ) + public void shouldThrowRuntimeInBeanMappingViaBaseException() throws TestExceptionBase { + Source source = new Source(); + source.setSize( 1 ); + SourceTargetMapper sourceTargetMapper = SourceTargetMapper.INSTANCE; + sourceTargetMapper.sourceToTargetViaBaseException( source ); + } + + @Test( expected = TestException2.class ) + @IssueKey( "198" ) + public void shouldThrowTestException2InBeanMappingViaBaseException() throws TestExceptionBase { + Source source = new Source(); + source.setSize( 2 ); + SourceTargetMapper sourceTargetMapper = SourceTargetMapper.INSTANCE; + sourceTargetMapper.sourceToTargetViaBaseException( source ); + } } diff --git a/processor/src/test/java/org/mapstruct/ap/test/exceptions/ExceptionTestDecorator.java b/processor/src/test/java/org/mapstruct/ap/test/exceptions/ExceptionTestDecorator.java new file mode 100644 index 000000000..5167fbcf6 --- /dev/null +++ b/processor/src/test/java/org/mapstruct/ap/test/exceptions/ExceptionTestDecorator.java @@ -0,0 +1,28 @@ +/** + * Copyright 2012-2014 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.test.exceptions; + +public abstract class ExceptionTestDecorator implements SourceTargetMapper { + + private final SourceTargetMapper delegate; + + public ExceptionTestDecorator(SourceTargetMapper delegate) { + this.delegate = delegate; + } +} diff --git a/processor/src/test/java/org/mapstruct/ap/test/exceptions/ExceptionTestMapper.java b/processor/src/test/java/org/mapstruct/ap/test/exceptions/ExceptionTestMapper.java index 811538eb5..0c89d0a61 100644 --- a/processor/src/test/java/org/mapstruct/ap/test/exceptions/ExceptionTestMapper.java +++ b/processor/src/test/java/org/mapstruct/ap/test/exceptions/ExceptionTestMapper.java @@ -18,6 +18,8 @@ */ package org.mapstruct.ap.test.exceptions; +import org.mapstruct.ap.test.exceptions.imports.TestException1; + /** * @author Sjaak Derksen * @@ -33,4 +35,14 @@ public class ExceptionTestMapper { } return new Long(size); } + + public Long toLong(Integer size) throws TestException1, TestException2 { + if ( size == 1 ) { + throw new TestException1(); + } + else if ( size == 2 ) { + throw new TestException2(); + } + return new Long(size); + } } diff --git a/processor/src/test/java/org/mapstruct/ap/test/exceptions/SourceTargetMapper.java b/processor/src/test/java/org/mapstruct/ap/test/exceptions/SourceTargetMapper.java index 7fbd1a8b7..e70db5811 100644 --- a/processor/src/test/java/org/mapstruct/ap/test/exceptions/SourceTargetMapper.java +++ b/processor/src/test/java/org/mapstruct/ap/test/exceptions/SourceTargetMapper.java @@ -19,6 +19,10 @@ package org.mapstruct.ap.test.exceptions; +import org.mapstruct.ap.test.exceptions.imports.TestExceptionBase; +import java.util.List; +import java.util.Map; +import org.mapstruct.DecoratedWith; import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; @@ -27,10 +31,19 @@ import org.mapstruct.factory.Mappers; * @author Sjaak Derksen */ @Mapper( uses = ExceptionTestMapper.class ) +@DecoratedWith( ExceptionTestDecorator.class ) public interface SourceTargetMapper { SourceTargetMapper INSTANCE = Mappers.getMapper( SourceTargetMapper.class ); Target sourceToTarget(Source source) throws TestException2; + List integerListToLongList(List sizes) throws TestException2; + + Map integerKeyMapToLongKeyMap(Map sizes) throws TestException2; + + Map integerValueMapToLongValueMap(Map sizes) throws TestException2; + + Target sourceToTargetViaBaseException(Source source) throws TestExceptionBase; + } diff --git a/processor/src/test/java/org/mapstruct/ap/test/exceptions/TestException2.java b/processor/src/test/java/org/mapstruct/ap/test/exceptions/TestException2.java index f4b8aa014..b3c8d8a57 100644 --- a/processor/src/test/java/org/mapstruct/ap/test/exceptions/TestException2.java +++ b/processor/src/test/java/org/mapstruct/ap/test/exceptions/TestException2.java @@ -18,9 +18,11 @@ */ package org.mapstruct.ap.test.exceptions; +import org.mapstruct.ap.test.exceptions.imports.TestExceptionBase; + /** * * @author Sjaak Derksen */ -public class TestException2 extends Exception { +public class TestException2 extends TestExceptionBase { } diff --git a/processor/src/test/java/org/mapstruct/ap/test/exceptions/TestException1.java b/processor/src/test/java/org/mapstruct/ap/test/exceptions/imports/TestException1.java similarity index 94% rename from processor/src/test/java/org/mapstruct/ap/test/exceptions/TestException1.java rename to processor/src/test/java/org/mapstruct/ap/test/exceptions/imports/TestException1.java index e8b752fea..c55293ad9 100644 --- a/processor/src/test/java/org/mapstruct/ap/test/exceptions/TestException1.java +++ b/processor/src/test/java/org/mapstruct/ap/test/exceptions/imports/TestException1.java @@ -16,7 +16,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.mapstruct.ap.test.exceptions; +package org.mapstruct.ap.test.exceptions.imports; /** * diff --git a/processor/src/test/java/org/mapstruct/ap/test/exceptions/imports/TestExceptionBase.java b/processor/src/test/java/org/mapstruct/ap/test/exceptions/imports/TestExceptionBase.java new file mode 100644 index 000000000..c82224572 --- /dev/null +++ b/processor/src/test/java/org/mapstruct/ap/test/exceptions/imports/TestExceptionBase.java @@ -0,0 +1,26 @@ +/** + * Copyright 2012-2014 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.test.exceptions.imports; + +/** + * + * @author Sjaak Derksen + */ +public class TestExceptionBase extends Exception { +}