12
12
13
13
import java .util .HashMap ;
14
14
import java .util .Map ;
15
+ import java .util .Objects ;
15
16
16
17
import org .eclipse .emf .ecore .EObject ;
17
18
@@ -48,8 +49,7 @@ public class BaseJavaScriptVariantHelper implements JavaScriptVariantHelper {
48
49
* This class defines all validation features.
49
50
*/
50
51
private static class ValidationFeatureBase {
51
- // This empty class allows for defining validation features as classes instead of enums
52
- // so that we can
52
+ // This empty class allows for defining validation features as classes instead of enums.
53
53
}
54
54
55
55
static class ValidationFeature <T > extends ValidationFeatureBase {
@@ -209,15 +209,15 @@ public FileExtensionValidationFeaturePair(String fileExtension, ValidationFeatur
209
209
public boolean equals (Object obj ) {
210
210
if (obj instanceof FileExtensionValidationFeaturePair ) {
211
211
FileExtensionValidationFeaturePair otherKey = (FileExtensionValidationFeaturePair ) obj ;
212
- return fileExtension .equals (otherKey .fileExtension )
213
- && validationFeature .equals (otherKey .validationFeature );
212
+ return Objects .equals (fileExtension , otherKey .fileExtension )
213
+ && Objects .equals (validationFeature , otherKey .validationFeature );
214
214
}
215
215
return false ;
216
216
}
217
217
218
218
@ Override
219
219
public int hashCode () {
220
- return fileExtension . hashCode () + 31 * validationFeature . hashCode ( );
220
+ return Objects . hash ( fileExtension , validationFeature );
221
221
}
222
222
}
223
223
@@ -240,6 +240,9 @@ protected BaseJavaScriptVariantHelper() {
240
240
*
241
241
*/
242
242
protected <T > void addEntry (String fileExtension , ValidationFeature <T > feature , T value ) {
243
+ Objects .requireNonNull (fileExtension );
244
+ Objects .requireNonNull (feature );
245
+ Objects .requireNonNull (value );
243
246
table .put (new FileExtensionValidationFeaturePair (fileExtension , feature ), value );
244
247
}
245
248
0 commit comments