@@ -209,6 +209,7 @@ public boolean visitField(String srcClsName, String srcName, @Nullable String sr
209
209
boolean subHasDstNames = subFeatures .fields ().dstNames () != FeaturePresence .ABSENT ;
210
210
boolean supHasDstDescs = supFeatures .fields ().dstDescs () != FeaturePresence .ABSENT ;
211
211
boolean subHasDstDescs = subFeatures .fields ().dstDescs () != FeaturePresence .ABSENT ;
212
+ boolean supRequiresSrcDescs = supFeatures .fields ().srcDescs () == FeaturePresence .REQUIRED ;
212
213
213
214
if (supFld == null ) { // supTree doesn't have this field, ensure the incoming mappings don't have any data for it
214
215
String [] subDstNames = null ;
@@ -217,8 +218,11 @@ public boolean visitField(String srcClsName, String srcName, @Nullable String sr
217
218
if (supHasDstNames && subHasDstNames ) subDstNames = supFeatures .hasNamespaces () || dstNames == null ? dstNames : new String []{dstNames [subNsIfSupNotNamespaced ]};
218
219
if (supHasDstDescs && subHasDstDescs ) subDstDescs = supFeatures .hasNamespaces () || dstDescs == null ? dstDescs : new String []{dstDescs [subNsIfSupNotNamespaced ]};
219
220
220
- assertTrue (isEmpty (subDstNames ) && isEmpty (subDstDescs ), "Incoming field not contained in supTree: " + subFldId );
221
- return true ;
221
+ boolean noData = isEmpty (subDstNames ) && isEmpty (subDstDescs );
222
+ boolean missingRequiredSrcDesc = supRequiresSrcDescs && srcDesc == null ;
223
+
224
+ assertTrue (noData || missingRequiredSrcDesc , "Incoming field not contained in supTree: " + subFldId );
225
+ return !missingRequiredSrcDesc ;
222
226
}
223
227
224
228
String supFldId = srcClsName + "#" + srcName + ":" + supFld .getSrcDesc ();
@@ -289,6 +293,7 @@ public boolean visitMethod(String srcClsName, String srcName, @Nullable String s
289
293
boolean subHasDstNames = subFeatures .methods ().dstNames () != FeaturePresence .ABSENT ;
290
294
boolean supHasDstDescs = supFeatures .methods ().dstDescs () != FeaturePresence .ABSENT ;
291
295
boolean subHasDstDescs = subFeatures .methods ().dstDescs () != FeaturePresence .ABSENT ;
296
+ boolean supRequiresSrcDescs = supFeatures .methods ().srcDescs () == FeaturePresence .REQUIRED ;
292
297
293
298
if (supMth == null ) { // supTree doesn't have this method, ensure the incoming mappings don't have any data for it
294
299
String [] subDstNames = null ;
@@ -297,8 +302,11 @@ public boolean visitMethod(String srcClsName, String srcName, @Nullable String s
297
302
if (supHasDstNames && subHasDstNames ) subDstNames = supFeatures .hasNamespaces () || dstNames == null ? dstNames : new String []{dstNames [subNsIfSupNotNamespaced ]};
298
303
if (supHasDstDescs && subHasDstDescs ) subDstDescs = supFeatures .hasNamespaces () || dstDescs == null ? dstDescs : new String []{dstDescs [subNsIfSupNotNamespaced ]};
299
304
300
- assertTrue (isEmpty (subDstNames ) && isEmpty (subDstDescs ), "Incoming method not contained in supTree: " + subMthId );
301
- return true ;
305
+ boolean noData = isEmpty (subDstNames ) && isEmpty (subDstDescs );
306
+ boolean missingRequiredSrcDesc = supRequiresSrcDescs && srcDesc == null ;
307
+
308
+ assertTrue (noData || missingRequiredSrcDesc , "Incoming method not contained in supTree: " + subMthId );
309
+ return !missingRequiredSrcDesc ;
302
310
}
303
311
304
312
String supMthId = srcClsName + "#" + srcName + supMth .getSrcDesc ();
0 commit comments