Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HV-1377 Adding a check if the type was already processed
- Loading branch information
1 parent
657cb07
commit 636a0d6
Showing
4 changed files
with
81 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
32 changes: 32 additions & 0 deletions
32
annotation-processor/src/test/java/org/hibernate/validator/ap/CircularNestedTypesTest.java
This file contains 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,32 @@ | ||
/* | ||
* Hibernate Validator, declare and validate application constraints | ||
* | ||
* License: Apache License, Version 2.0 | ||
* See the license.txt file in the root directory or <http://www.apache.org/licenses/LICENSE-2.0>. | ||
*/ | ||
package org.hibernate.validator.ap; | ||
|
||
import static org.testng.Assert.assertTrue; | ||
|
||
import org.hibernate.validator.ap.testmodel.circular.CircularProperty; | ||
import org.hibernate.validator.ap.testmodel.circular.CircularPropertyImpl; | ||
import org.testng.annotations.Test; | ||
|
||
/** | ||
* Tests that in case of circular nested types there's no infinite loop during analysis. | ||
* | ||
* @author Marko Bekhta | ||
*/ | ||
public class CircularNestedTypesTest extends ConstraintValidationProcessorTestBase { | ||
|
||
@Test | ||
public void testNoInfiniteLoop() { | ||
boolean compilationResult = | ||
compilerHelper.compile( new ConstraintValidationProcessor(), diagnostics, | ||
compilerHelper.getSourceFile( CircularPropertyImpl.class ), | ||
compilerHelper.getSourceFile( CircularProperty.class ) | ||
); | ||
|
||
assertTrue( compilationResult ); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
...ocessor/src/test/java/org/hibernate/validator/ap/testmodel/circular/CircularProperty.java
This file contains 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,20 @@ | ||
/* | ||
* Hibernate Validator, declare and validate application constraints | ||
* | ||
* License: Apache License, Version 2.0 | ||
* See the license.txt file in the root directory or <http://www.apache.org/licenses/LICENSE-2.0>. | ||
*/ | ||
package org.hibernate.validator.ap.testmodel.circular; | ||
|
||
/** | ||
* @author Marko Bekhta | ||
*/ | ||
public interface CircularProperty { | ||
|
||
void doSomething(); | ||
|
||
interface ImprovedCircularProperty extends CircularProperty { | ||
|
||
void maybeDoSomething(); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
...sor/src/test/java/org/hibernate/validator/ap/testmodel/circular/CircularPropertyImpl.java
This file contains 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,18 @@ | ||
/* | ||
* Hibernate Validator, declare and validate application constraints | ||
* | ||
* License: Apache License, Version 2.0 | ||
* See the license.txt file in the root directory or <http://www.apache.org/licenses/LICENSE-2.0>. | ||
*/ | ||
package org.hibernate.validator.ap.testmodel.circular; | ||
|
||
/** | ||
* @author Marko Bekhta | ||
*/ | ||
public class CircularPropertyImpl implements CircularProperty { | ||
|
||
@Override | ||
public void doSomething() { | ||
//nothing here | ||
} | ||
} |