@@ -1504,6 +1504,13 @@ void synthesizeWithoutAttributeAliases() throws Exception {
1504
1504
assertThat (synthesizedComponent .value ()).isEqualTo ("webController" );
1505
1505
}
1506
1506
1507
+ @ Test
1508
+ void isSynthesizableWithoutAttributeAliases () throws Exception {
1509
+ Component component = WebController .class .getAnnotation (Component .class );
1510
+ assertThat (component ).isNotNull ();
1511
+ assertThat (MergedAnnotation .from (component ).isSynthesizable ()).isFalse ();
1512
+ }
1513
+
1507
1514
@ Test
1508
1515
void synthesizeAlreadySynthesized () throws Exception {
1509
1516
Method method = WebController .class .getMethod ("handleMappedWithValueAttribute" );
@@ -1567,10 +1574,16 @@ void synthesizeWhenUsingMergedAnnotationsFromApi() {
1567
1574
void synthesizeShouldNotSynthesizeNonsynthesizableAnnotationsWhenUsingMergedAnnotationsFromApi () {
1568
1575
MergedAnnotations mergedAnnotations = MergedAnnotations .from (SecurityConfig .class );
1569
1576
1570
- EnableWebSecurity enableWebSecurity = mergedAnnotations .get (EnableWebSecurity .class ).synthesize ();
1577
+ MergedAnnotation <EnableWebSecurity > enableWebSecurityAnnotation =
1578
+ mergedAnnotations .get (EnableWebSecurity .class );
1579
+ assertThat (enableWebSecurityAnnotation .isSynthesizable ()).isFalse ();
1580
+ EnableWebSecurity enableWebSecurity = enableWebSecurityAnnotation .synthesize ();
1571
1581
assertThat (enableWebSecurity ).isNotInstanceOf (SynthesizedAnnotation .class );
1572
1582
1573
- EnableGlobalAuthentication enableGlobalAuthentication = mergedAnnotations .get (EnableGlobalAuthentication .class ).synthesize ();
1583
+ MergedAnnotation <EnableGlobalAuthentication > enableGlobalAuthenticationMergedAnnotation =
1584
+ mergedAnnotations .get (EnableGlobalAuthentication .class );
1585
+ assertThat (enableGlobalAuthenticationMergedAnnotation .isSynthesizable ()).isFalse ();
1586
+ EnableGlobalAuthentication enableGlobalAuthentication = enableGlobalAuthenticationMergedAnnotation .synthesize ();
1574
1587
assertThat (enableGlobalAuthentication ).isNotInstanceOf (SynthesizedAnnotation .class );
1575
1588
}
1576
1589
@@ -1718,8 +1731,9 @@ private void testSynthesisWithImplicitAliases(Class<?> clazz, String expected)
1718
1731
ImplicitAliasesTestConfiguration config = clazz .getAnnotation (
1719
1732
ImplicitAliasesTestConfiguration .class );
1720
1733
assertThat (config ).isNotNull ();
1721
- ImplicitAliasesTestConfiguration synthesized = MergedAnnotation .from (
1722
- config ).synthesize ();
1734
+ MergedAnnotation <ImplicitAliasesTestConfiguration > mergedAnnotation = MergedAnnotation .from (config );
1735
+ assertThat (mergedAnnotation .isSynthesizable ()).isTrue ();
1736
+ ImplicitAliasesTestConfiguration synthesized = mergedAnnotation .synthesize ();
1723
1737
assertThat (synthesized ).isInstanceOf (SynthesizedAnnotation .class );
1724
1738
assertThat (synthesized .value ()).isEqualTo (expected );
1725
1739
assertThat (synthesized .location1 ()).isEqualTo (expected );
@@ -1746,8 +1760,11 @@ private void testSynthesisWithImplicitAliasesWithImpliedAliasNamesOmitted(
1746
1760
ImplicitAliasesWithImpliedAliasNamesOmittedTestConfiguration config = clazz .getAnnotation (
1747
1761
ImplicitAliasesWithImpliedAliasNamesOmittedTestConfiguration .class );
1748
1762
assertThat (config ).isNotNull ();
1763
+ MergedAnnotation <ImplicitAliasesWithImpliedAliasNamesOmittedTestConfiguration > mergedAnnotation =
1764
+ MergedAnnotation .from (config );
1765
+ assertThat (mergedAnnotation .isSynthesizable ()).isTrue ();
1749
1766
ImplicitAliasesWithImpliedAliasNamesOmittedTestConfiguration synthesized =
1750
- MergedAnnotation . from ( config ) .synthesize ();
1767
+ mergedAnnotation .synthesize ();
1751
1768
assertThat (synthesized ).isInstanceOf (SynthesizedAnnotation .class );
1752
1769
assertThat (synthesized .value ()).isEqualTo (expected );
1753
1770
assertThat (synthesized .location ()).isEqualTo (expected );
0 commit comments